Python Practice Set 1 (Beginners)
Welcome to your first Python practice set!
This set is based on the topics we’ve covered so far: installation, syntax, variables,
typecasting, user input, comments, and operators.
Try to solve each problem on your own before looking at the solution.
Q1: Your First Program
Write a program that prints:
Hello, World! Welcome to Python.
Q2: Print a Poem
Write a program that prints the following poem using a single print() statement:
Twinkle, twinkle, little star,
How I wonder what you are!
(Hint: Use \n for a new line.)
Q3: Variables & Data Types
Create variables to store: - Your name (string)
- Your age (integer)
- Your height in meters (float)
- A boolean value representing whether you are a student
Print all of them in one line.
Q4: Typecasting Practice
You are given a string:
num = "45"
Convert it into an integer and add 10 to it. Print the result.
Q5: Taking User Input
Write a program that:
1. Asks the user for their favorite food.
2. Prints:
Wow! I also like <food>.
Q6: Simple Calculator
Write a program that:
1. Takes two numbers as input from the user.
2. Prints their sum, difference, product, and quotient.
Q7: Escape Sequences
Print the following output using escape sequences:
Harry said, "Python is awesome!"
This is on a new line.
This is a tab -> <- here
Q8: Operator Challenge
Write a program that:
1. Takes an integer as input from the user.
2. Prints the square and cube of that number.
Q9: Quick Quiz (True/False)
Mark True or False:
1. Python code must always end with a semicolon ; .
2. The # symbol is used for comments in Python.
3. "123" and 123 are the same in Python.
4. The * operator is used for multiplication.
5. \n creates a new line.
6. Variables in Python can start with numbers.
7. int("10") + 5 gives 15 .