Learn Python first if you are new to programming or drawn to data and AI. Learn TypeScript first only if you already know some JavaScript or are certain about web development, and even then learn plain JavaScript for a few weeks before the types. The second language is much easier than the first.
What people tell me
I am about to start learning to code seriously. I keep reading that TypeScript is now what companies use for web and even for AI tools, while others say Python is the language of AI and the easiest to start with. I do not want to learn one and then find out the other was the right choice. Which one should I learn first?
A composite of the messages behind this question, with personal details left out.
Key takeaways
- For a complete beginner, Python is the gentler first language.
- TypeScript is JavaScript with types; learn some JavaScript before the types.
- Pick by direction: web products lean TypeScript, data and ML lean Python.
- AI application work is done in both, so AI is not a tie breaker.
- Plan to learn both eventually; the second takes weeks, not months.
How this differs from Python or JavaScript
I have answered the classic version of this in Should I learn Python or JavaScript first?. The TypeScript version comes up because many teams now write their web code, and a lot of their AI tooling, in TypeScript rather than plain JavaScript. So people ask whether they should skip straight to it.
What TypeScript actually is
TypeScript is JavaScript with a type system on top. You write the same language, plus annotations that say what shape your data has, and a compiler checks them before the code runs. It then turns everything back into JavaScript. That means you cannot really learn TypeScript without learning JavaScript. The types are an extra layer that catches mistakes, not a different language.
For a beginner, that layer adds a second set of error messages at exactly the moment you are still learning what a loop or a function is. It is not impossible, but it is harder.
The comparison
| Python | TypeScript | |
|---|---|---|
| First-week experience | Short, readable programs, few surprises | JavaScript quirks plus type errors |
| Strongest areas | Data, ML, scripting, backend APIs | Web frontends, Node backends, full stack apps |
| AI application work | Very common | Very common |
| Where it runs | Your machine and servers | Browsers, servers and edge platforms |
| Good first project | Scripts that automate something you do | A small web app someone else can open |
My recommendation
- Complete beginner, unsure of direction: start with Python. Its syntax gets out of your way, and you learn programming concepts rather than tooling.
- Sure you want web development: start with JavaScript for four to six weeks, then move to TypeScript as soon as your projects have more than a couple of files. That is when the types start helping.
- Interested in data or machine learning: Python, clearly. The libraries and courses are built around it.
- Already know some JavaScript: move to TypeScript now. You will write better code and it is what most web teams expect.
Is AI a reason to pick one?
Not really. Model providers publish official SDKs for both Python and TypeScript, and agent frameworks exist in both. Research and model training lean Python. Products that put AI into a web app often lean TypeScript. At the beginner stage, the language matters much less than learning to structure a program.
Free places to learn each
For Python: CS50's Introduction to Programming with Python and The Python Tutorial. For JavaScript and then TypeScript: The Odin Project, then The TypeScript Handbook. If you enjoy TypeScript and want depth later, Total TypeScript is worth a look.
The programming roadmap takes you through either language in the same order, with checks at each stage, and the frontend roadmap picks up where web development starts.
The part people underestimate
Your second language will take weeks, not months. Variables, loops, functions, data structures and debugging carry over. What does not carry over is switching every few weeks and never getting deep in either. Pick one, give it three months, build three small things in it, then decide what is next.
If you are still stuck
Read Which programming language should I learn first? and How do I stop switching technologies and commit to one path?. If you want help choosing based on your own goals, join Sefism and, as a member, book a 1:1 session.
Was this answer helpful?
Read next
- The Defaults I Would Learn First as a Software EngineerFourteen software engineering best practices written as defaults: prototype vague requirements, choose boring tools, wait for the third duplicate, write the failing test first, measure before optimising, ask after an hour.
- Thirteen Web Development Habits That Outlast the FrameworkThirteen web development best practices that stay true whatever framework is in fashion: semantic HTML, one source of truth, server-side validation, caching, image weight, rate limits and small releases.
Your situation is not quite this one?
Members get written answers to their own questions, a roadmap built for them and feedback on their projects. Early access is open: sign up and your account is active shortly after. Prefer to talk? A free call works too.