
Basic Python Practice Questions with Answers
1. Python Syntax — 10 Questions
1. Print "Hello, World!"
Output:
2. Create a variable and print it
Output:
3. Create two variables and print them
Output:
4. Write a comment
Output:
5. Print name, age, and city
Output:
6. Use an if statement
Output:
7. Create student_name
Output:
8. Are name and Name the same?
Output:
Answer: No. Python is case-sensitive.
9. Print three messages
Output:
10. Find the syntax error
Output:
Correct code:
Output:
🐍 2. Data Types — 10 Questions
1. Integer
Output:
2. Float
Output:
3. String
Output:
4. Boolean
Output:
5. List
Output:
6. Tuple
Output:
7. Set
Output:
8. Dictionary
Output:
9. Check the type of 25
Output:
10. List vs Tuple
Output:
Difference: List can be changed, while tuple cannot be changed.
🐍 3. Operators — 10 Questions
1. Addition
Output:
2. Subtraction
Output:
3. Multiplication
Output:
4. Division
Output:
5. Remainder
Output:
6. Power
Output:
7. Floor division
Output:
8. Greater than
Output:
9. Equal to
Output:
10. Using and
Output:
🐍 4. Input and Output — 10 Questions
1. Take name as input
Output:
2. Take age as input
Output:
3. Add two numbers
Output:
4. Multiply two numbers
Output:
5. Take name and age
Output:
6. Take a decimal number
Output:
7. Take two numbers in one line
Output:
8. Calculate rectangle area
Output:
9. Find square
Output:
10. Take name and city
Output:
🐍 5. Conditions — 10 Questions
1. Positive or Negative
Output:
2. Even or Odd
Output:
3. Voting eligibility
Output:
4. Greater of two numbers
Output:
5. Largest of three numbers
Output:
6. Positive, Negative, or Zero
Output:
7. Pass or Fail
Output:
8. Grade
Output:
9. Divisible by 5
Output:
10. Simple Calculator
Output:
🐍 6. Loops — 10 Questions
1. Print 1 to 10
Output:
2. Print 10 to 1
Output:
3. Print even numbers from 1 to 20
Output:
4. Print odd numbers from 1 to 20
Output:
5. Multiplication table of 5
Output:
6. Sum from 1 to 10
Output:
7. Print 1 to 10 using while
Output:
8. Stop at 5 using break
Output:
9. Skip 5 using continue
Output:
10. Factorial of a number
Output:
Join Techsnap Creators
Share your knowledge and earn ??
Want to showcase your tech expertise and get rewarded for your insights? Join the Techsnap creator network!
Write insightful blogs, stay ahead of industry trends, and grow your professional brand while helping others in the community.
Ready to make an impact?

Comments