Exercise 1 · Lesson 18Solved
Your First Line of Python
Print exactly this sentence: Hello, AI world!
Python Practice
Write real Python, run it and get instant feedback, with nothing to install. The exercises follow Season 2 lesson by lesson, from your first line to handling bad data.
Exercise 1 · Lesson 18Solved
Print exactly this sentence: Hello, AI world!
Exercise 2 · Lesson 19Solved
A job ad offers a yearly salary of 54000 euros. Store it in a variable called yearly, then create monthly as yearly divided by 12 and print monthly.
Exercise 3 · Lesson 20Solved
Using the two variables given, print one line that reads exactly: Sahar is learning Python for 30 minutes a day. Use an f-string, so the name and the number come from the variables.
Exercise 4 · Lesson 21Solved
The list skills holds the skills a job ad asks for. Print how many skills it holds, then add "Docker" to the end of the list and print the whole list.
Exercise 5 · Lesson 21Solved
The dictionary salaries maps a role to a starting salary. Add the role "MLOps Engineer" with 58000, then print the salary of "Data Engineer".
Exercise 6 · Lesson 22Solved
Loop over titles and print only the job titles that contain the word "Senior", one per line.
Exercise 7 · Lesson 22Solved
For each score in scores, print "Pass" if it is 70 or more, otherwise print "Retry". One word per line, in order.
Exercise 8 · Lesson 23Solved
A rough rule says one token is about 4 characters of English. Write a function estimate_tokens(text) that returns the length of text divided by 4, rounded to a whole number with round().
Exercise 9 · Lesson 24Solved
A file called jobs.csv is ready, with a header line and one job per line: title,company,city. Open it, skip the header, and print the company of each job, one per line.
Exercise 10 · Lesson 25Solved
Some salaries in raw were typed badly. Loop over raw, turn each value into an int and add it to total. When a value cannot be turned into a number, skip it with try and except ValueError. Finally print total.
Press Run to see what your code prints.
No. Python runs inside your browser, on your own computer, thanks to Pyodide (the real CPython, compiled for the web). The first run downloads it once, about 12 MB; after that it starts in a second or two.
No. Your code runs and is checked in your browser. Your drafts and the exercises you solve are saved in this browser only, so they stay private and are not linked to your account.
They follow Season 2 of the curriculum, Python, lesson by lesson: your first script, variables, strings and f-strings, lists and dictionaries, loops, functions, files and errors. Each exercise only uses what its lesson and the lessons before it teach.
Press Stop. Your code runs separately from the page, so a loop that never ends cannot freeze the site, and it is stopped by itself after 15 seconds.
Subscribe on YouTube, or get an email the day each new lesson goes live.
Ask ai2hired
Answers from this site only, with the pages they come from.
Hi! I can help with the free course: lessons, seasons, career paths, workbooks, credentials, the free tools and your account.
AI answers can be wrong: check the linked page. The chat stays in this browser only. Need a person? Contact us