Day 1 — Python Practice
Use only variables, print, and the data types str, int, and float. Try each exercise before asking for the answer.
Exercise 1 — Print text
Print your name and this sentence on two separate lines:
I am learning Python.
Hint: Put text inside quotation marks.
Exercise 2 — Create a variable
Create a variable called city. Give it the name of your city, then print its value.
Hint: Do not put the variable name inside quotation marks when printing its value.
Exercise 3 — Use three data types
Create these variables:
name: your name as a string.age: your age as an integer.study_hours: your daily study hours as a float.
Print each value with a clear label, such as Name:.
Exercise 4 — Change a value
Create a variable called goal and print its value. Then give the same variable a new value and print it again.
Hint: Python runs these instructions from top to bottom.
Exercise 5 — Find and fix two mistakes
This code should print the job. Find and correct its two mistakes:
job = SEO Managerprint(Job)
Hint: Check the quotation marks and capital letters.
Mini-project — Introduce yourself
Create a file called about_me.py. Use these six variables:
| Variable | Information | Data type |
|---|---|---|
name | Your name | str |
city | Your city | str |
job | Your job | str |
age | Your age | int |
daily_study_hours | Your daily study hours | float |
goal | Your learning goal | str |
Print all six values with clear labels. Then change your city and study hours, save the file, and run it again.
Success criteria: Your program runs without errors, displays all six values, and shows the new values after you change them.
