It's hard for those of us who have been programming for years to "get" what it feels like to start from nothing. I would steer clear of anything needing more than 5 lines of code.

You need to decide the order in which you cover things such as User Input, Output, if, else, while, for, file io etc.

When covering IF do they already know how to get some user input? Print some output? Code a FOR loop? Do arithmentic on integers? Determine whether a number is divisible by another number?

The answers to these questions constrains your examples for IF.

I'd suggest doing Output, Arithmentic, FOR, Divisibility (modulus), User Input before doing IF.

Then I can pose problems such as

Print the first 100 odd numbers
Determine the factors of a number entered  by the user
Play a number guessing game (User enters a guess, you print YES or Higher or Lower)
Answer from djna on Stack Overflow
🌐
CS-IP-Learning-Hub
csiplearninghub.com › python-if-else-conditional-statement-practice
70+ Python if else Statement Important Practice Questions - CS-IP-Learning-Hub
October 28, 2025 - #3 Update This Code Eng = int ( input (“Enter English Marks : ” )) Math = int ( input (“Enter Maths Marks : ” )) Sci = int ( input (“Enter Science Marks : ” )) SS = int ( input (“Enter Social Science Marks : ” )) if Eng > 80 and Math > 80 and Sci > 80 and SS > 80 : print(“Eligible for Science Stream”) elif Eng > 80 and Math > 50 and Sci > 50 : print(“Eligible for Commerce Stream”) else : if Eng > 80 and SS > 80 : print(“Eligible for Humanities Stream”) Reply ... I am a teacher with more than 19 years of experience in education field. You can contact me at csiplearninghub@gmail.com · Ch 1 AI Project Life Cycle Class 8 Question Answer June 30, 2026
🌐
edSlash
edslash.com › home › if else practice questions in python
if else practice questions in Python - edSlash
September 27, 2025 - Practice your Python skills with our list of if-else practice questions. Each question comes with a detailed solution to help you learn and improve.
Discussions

(beginner) if/elif/else exercises
Look up the “fizz buzz” problem, that’s an excellent example of if/elif/else More on reddit.com
🌐 r/learnpython
19
50
November 27, 2021
if statement - What are good programming questions to exercise the use of "if ... else" in Python? - Stack Overflow
What would be a good set of programming exercises that would help Python newbies to learn the use of the "if ... else" construct? I could cook up the following, do you know of any more? Find the la... More on stackoverflow.com
🌐 stackoverflow.com
[BEGINNER COURSE] (If statement exercise went wrong)

It's really hard to tell what is wrong with your code because it isn't formatted properly. Python uses white-space to define and separate individual code blocks and what you've shown us is just a few dozen individual lines of code with no discernible separation between them.

That said, there are a few things that stand out right away:

  1. Your input needs to be stored somewhere. The way your code is written, the second this line executes and you respond to it then "POOF" it is gone. Open your terminal then type "python3" to open an interactive terminal. Type "input("What is your gender: ") and see what happens. Now type "gender = input("What is your gender:") What's the difference? Now type "gender" and see what happens.

  2. ".lower" is a string method that isn't being called (strings are objects that have methods associated with them and methods are like functions that need to be called). Just like when you call your functions at the end of your program with "is_male()" and "gender_print()", ".lower" needs "()" to call this method" Again, in your terminal type "my_string = 'THIS IS MY STRING.'" Now type "my_string.lower" and "my_string.lower()" What's the difference?

  3. Learn about scope. There are things happening inside your functions that are independent of what is happening outside of your functions. Variables that are declared inside your function are not necessarily the same as variables that are declared outside of it. If you want to pass attributes of your global scope (like what you captured in your input), then try passing it to your function as input like so "def is_male(gender)" and now you can use this gender in your conditional statement.

  4. Again, more scope issues. Lack of indenting makes it unclear, but it would appear that the variable male is being declared inside your variable and thus its scope is limited to inside of that function. If you want to use that variable outside of that function you have to return it to the global scope (end your function with "return male") and store it in a variable in the global scope to use it (try assigning your new function call to a variable with 'male = is_male()' and using this new variable).

I'm sure there are other ways to do these things and other users may have their thoughts or disagree with my opinions, but this is where I would start. Again, I'd like to say that it's a little hard to understand what your code is trying to do when I can't read it as it should be written with the correct formatting so I'm doing a little guess-work. Also, as a beginner, the interactive terminal is your friend. Build your code step-by-step and examine it as you go. Break your code in to manageable pieces that you can test independently so you can better find bugs and understand what your code is doing. When you're sure that each of these manageable pieces work correctly then add them to your ".py" file to run as a complete script.

I hope this helps!

More on reddit.com
🌐 r/learnpython
17
0
December 30, 2021
Practice python coding
I can only higly recommend https://www.codingame.com/home You have puzzles that are easy to harder (and extra harder). And you have challenge (quick challenge, long challenge)... It's very fun. More on reddit.com
🌐 r/learnprogramming
72
638
February 27, 2019
🌐
PYnative
pynative.com › home › python exercises › python loops exercises: 40+ coding problems with solutions
40 Python Loops Coding Exercises with Solutions – PYnative
June 13, 2026 - Given number is palindrome number") else: print("No. Given number is not palindrome")Code language: Python (python) Run ... temp = number: Since our loop reduces number to 0, we must save the original value in temp to verify if the reversal matches. Comparison Logic: The if temp == reverse_num check is the “decision point” that classifies the data. Practice Problem: Write a program to use a loop to find the factorial of a given number (e.g., 5!).
🌐
Reddit
reddit.com › r/learnpython › (beginner) if/elif/else exercises
r/learnpython on Reddit: (beginner) if/elif/else exercises
November 27, 2021 -

Hi all.

Can you recommend if/elif/else exercises for beginner level?

I'm studying the "100 days of Python" by Angela Yu and, although I feel like I'm understanding some of the content, I feel like I should study this subject more before moving on with the lessons

Thanks in advance.

🌐
LearnPython.com
learnpython.com › blog › if-else-python-practice-problems
10 if-else Practice Problems in Python | LearnPython.com
If you’re looking to learn programming with Python, doing practice exercises is a great way to learn. Here, we’ll give you 10 exercises for writing if-else statements with detailed solutions and explanations.
🌐
HackerRank
hackerrank.com › challenges › py-if-else › problem
Python If-Else | HackerRank
Introduction · Python If-Else · Problem · Submissions · Leaderboard · Discussions · Editorial · Tutorial · Check Tutorial tab to know how to solve. Task Given an integer, , perform the following conditional actions: If is odd, print Weird · ...
🌐
Codesolid
codesolid.github.io › solutions › BooleanExpressionsExercises.html
Python If/Else and Booleans: Examples and Practice Questions — Python In Practice
Single equals is used for assignment, as in message = “Hello”. Some others evaluate to False, that’s OK, they’re still valid boolean expressions. Number 5 might throw an exception if my_variable is not defined, but it’s valid otherwise. ... noise_level = 2 heat_output_percent = 98 if noise_level > 4 or heat_output_percent < 95: print("Call technician") else: print("Normal operation")
Find elsewhere
🌐
Programiz
programiz.com › python-programming › if-elif-else
Python if, if...else Statement (With Examples)
number = 5 # outer if statement if number >= 0: # inner if statement if number == 0: print('Number is 0') # inner else statement else: print('Number is positive') # outer else statement else: print('Number is negative') ... Here's how this program works. ... In certain situations, the if statement ...
🌐
w3resource
w3resource.com › python-exercises › python-conditional-statements-and-loop-exercises.php
Python conditional statements and loops - Exercises, Practice, Solution - w3resource
Learn about Python conditional statements and loops with 44 exercises and solutions. Practice writing code to find numbers divisible by 7 and multiples of 5, convert temperatures between Celsius and Fahrenheit, guess numbers, construct patterns, count even and odd numbers, and much more.
Top answer
1 of 11
9

It's hard for those of us who have been programming for years to "get" what it feels like to start from nothing. I would steer clear of anything needing more than 5 lines of code.

You need to decide the order in which you cover things such as User Input, Output, if, else, while, for, file io etc.

When covering IF do they already know how to get some user input? Print some output? Code a FOR loop? Do arithmentic on integers? Determine whether a number is divisible by another number?

The answers to these questions constrains your examples for IF.

I'd suggest doing Output, Arithmentic, FOR, Divisibility (modulus), User Input before doing IF.

Then I can pose problems such as

Print the first 100 odd numbers
Determine the factors of a number entered  by the user
Play a number guessing game (User enters a guess, you print YES or Higher or Lower)
2 of 11
9

"Figure out whether a given year is a leap year" springs to mind almost immediately. Just give 'em the rules and turn 'em loose.

Other possibilities (albeit with stuff other than if statements):

  • Hunt the Wumpus (you may have to google for this one, I'm showing my age).
  • The perennial "detect a win in a Tic Tac Toe (Noughts and Crosses) game" (you could do this with eight if statements if you don't want a loop).
  • Guessing a number between 1 and 100 as quickly as possible (higher, lower).

For nothing but if/else statements, the leap year one is good. You could also consider:

  • Test if a number is a multiple of 3, 5 or 7.
  • Given an age, figure out whether someone's a baby, toddler, child, teenager, adult or old codger.
  • Calculate grades A-F based on final percentage score.
  • Given a number on the roulette table, figure out whether it's red/black, high/low and odd/even.
  • Given a blackjack hand, check if it's okay or bust (this is good since J/Q/K morph into 10). You could also figure out whether to draw another card (if total under 17 for example).

That's just a smattering of possibilities that you could get away with.

🌐
CodeChef
codechef.com › blogs › if-else-conditions-in-python
If Else Conditions in Python
July 10, 2024 - Learn Python conditions and if-else statements in this beginner-friendly guide. Understand the basics of decision-making in programming with clear explanations and practical examples.
🌐
GitHub
github.com › aisha-batool › Python-Practice-Exercises › blob › master › 5- IF, ELSE AND ELSE IF STATEMENTS, TESTING SET OF CONDITIONS.pdf
Python-Practice-Exercises/5- IF, ELSE AND ELSE IF STATEMENTS, TESTING SET OF CONDITIONS.pdf at master · aisha-batool/Python-Practice-Exercises
Basic Python Practice Exercises for brushing up Python Syntax - Python-Practice-Exercises/5- IF, ELSE AND ELSE IF STATEMENTS, TESTING SET OF CONDITIONS.pdf at master · aisha-batool/Python-Practice-Exercises
Author   aisha-batool
🌐
YouTube
youtube.com › watch
18 | If and Else practice questions in Python? Hands-On - YouTube
If and else practice questions in Python hands-onPython for Beginners GitHub: https://github.com/hemansnation/Python-For-Beginners0:00 Practice Questions0:40...
Published   February 13, 2023
🌐
Plain English
python.plainenglish.io › 10-if-else-practice-problems-in-python-7f882e828d6a
10 If-Else Practice Problems in Python | Python in Plain English
July 7, 2024 - If the condition is false, the code within the optional else block is executed instead. ... In this example, if x is greater than 5, the program prints “x is greater than 5”; otherwise, it prints “x is not greater than 5”. This concept forms the backbone of decision-making in Python ...
🌐
Bhutan Python Coders
bhutanpythoncoders.com › home › practice questions for conditional statements
Practice questions for conditional statements -
October 28, 2021 - age = int(input("Enter voters age:")) if age >= 18: print("You can cast your vote!") else: print("Sorry! You are not eligible to vote!") ... #output 1 Enter voters age:17 Sorry! You are not eligible to vote! # output 2 Enter voters age:20 You can cast your vote! Write a python program that will check for the following conditions:
🌐
Medium
medium.com › @keerthanam4141 › basic-if-else-loop-coding-questions-in-python-705caa1cd23f
Basic if else loop coding questions in python | by Data Sequel | Medium
May 6, 2023 - 3. Write a Python program that takes a list of numbers as input from the user and prints the sum of all the even numbers in the list. num_list = input("Enter a list of numbers separated by space: ").split() sum = 0 for num in num_list: if int(num) % 2 == 0: sum += int(num) print("Sum of even numbers:", sum) These are just a few examples of basic if/else loop coding interview questions in Python.
🌐
CodeChef
codechef.com › practice › course › python › LPPYAS06 › problems › LPYAS57
Use of if-else Question in Python
Test your Learn Python Programming knowledge with our Use of if-else practice problem. Dive into the world of python challenges at CodeChef.
🌐
Modern Age Coders
learn.modernagecoders.com › home › resources › python › conditional statements in python (if, elif, else) › practice
Conditional Statements in Python (if, elif, else) Practice | Python
60+ practice questions on Conditional Statements in Python (if, elif, else) in Python. Easy, medium, and hard questions with hints, answers, and coding challenges.
🌐
Scribd
scribd.com › document › 787393726 › Python-if-Else-Statement-Important-Practice-Questions
Python If-Else Practice Questions | PDF | Computer Programming | Software Engineering
Save Python if Else Statement Important Practice Questi... For Later ... Q1. Name the keyword which helps in writing code involves condition.