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
🌐
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 - Reverse the number (as shown in Exercise 14). Then, use a if-else statement to compare the reversed number with the original input. ... number = 121 # Store original to compare later temp = number reverse_num = 0 while number > 0: digit = number % 10 reverse_num = (reverse_num * 10) + digit number = number // 10 if temp == reverse_num: print("Yes. Given number is palindrome number") else: print("No. Given number is not palindrome")Code language: Python (python) Run
🌐
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.

if/elif/else Statements Jul 9, 2020
r/learnpython
6y ago
Another ... if, elif, return question Sep 17, 2018
r/learnpython
7y ago
Alternatives to if, elif, etc. Oct 18, 2024
r/learnpython
last yr.
More results from reddit.com
Discussions

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) 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
[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
People also ask

How do you write an if statement in Python?
Use if condition: followed by an indented code block.
🌐
pythonbasics.org
pythonbasics.org › home › python basics › if statements explained
If Statements Explained - pythonbasics.org
What is elif in Python?
elif means "else if" and lets you check multiple conditions in sequence.
🌐
pythonbasics.org
pythonbasics.org › home › python basics › if statements explained
If Statements Explained - pythonbasics.org
🌐
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 - Exercise: Write a Python script that accepts a recipe string from the user and prints an ordered list of sentences. ... recipe = input('Paste your recipe: ') counter = 1 ordered_list = str(counter) + '. ' for letter in recipe: if letter == '.': counter += 1 ordered_list += '.\n' + str(counter) ...
🌐
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
🌐
Python Basics
pythonbasics.org › home › python basics › if statements explained
If Statements Explained - pythonbasics.org
PyChallenge has 200+ interactive exercises from beginner to interview prep. Use if condition: followed by an indented code block. elif means "else if" and lets you check multiple conditions in sequence.
🌐
BrainStation®
brainstation.io › learn › python › if-statement
Python If Statement (2026 Tutorial & Examples) | BrainStation®
February 4, 2025 - A number that is perfectly divisible by 2 (the remainder being 0), is even, else it is an odd number. Create a variable called input_num and assign it a value of 3 to start with. Write an if...elif...else statement as follows to determine whether ...
Find elsewhere
🌐
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 - ME= int(input(‘Enter English Marks out of 100: ‘)) MM= int(input(‘Enter Maths Marks out of 100: ‘)) MS= int(input(‘Enter Science Marks out of 100: ‘)) MSS= int(input(‘Enter SST Marks out of 100: ‘)) SF = float(ME+MM+MS+MSS) CF = float(ME+MM+MS+MSS) Hm = float(MS+MSS) if SF>=320: print (‘You are eligible for Science Faculty’) elif CF>=260 and CF=50 and Hm <200: print ('You are eligible for Humanities') (Its a junior and just a beginner Python programmer from Pakistan.
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.

🌐
w3resource
w3resource.com › python-exercises › python-conditional-statements-and-loop-exercises.php
Python conditional statements and loops - Exercises, Practice, Solution - w3resource
This resource offers a total of 220 Python conditional statements and loops problems for practice. It includes 44 main exercises, each accompanied by solutions, detailed explanations, and four related problems.
🌐
LearnPython.com
learnpython.com › blog › if-else-python-practice-problems
10 if-else Practice Problems in Python | LearnPython.com
Exercise: Write a function named return_bigger(a, b) that takes two numbers and returns the bigger one. If the numbers are equal, return 0. ... Explanation: When using if statements in a function, you can define a return value in the indented ...
🌐
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.
🌐
Space Python
spacepython.com › home › blog › python fundamentals › python if/else for beginners
Python If/Else for Beginners
January 13, 2026 - Learn Python if, elif, and else with clear, space-themed examples and hands-on exercises. Perfect for beginners who want to chart the control flow of their programs.
🌐
W3Schools
w3schools.com › python › exercise.asp
Exercise: - Python If
I completed one of the Python exercises on w3schools.com
🌐
Nanyang Technological University
libguides.ntu.edu.sg › python › ifelifelse
1.13 Conditional statements (if-elif-else) - Python for Basic Data Analysis - LibGuides at Nanyang Technological University
3. If-elif-else - Assign 0 to z. If x is bigger than 0, print "x is a positive number". Else if x is zero, print "x is 0". Else, print "x is a negative number". ... Python If ...
🌐
SQATools
sqatools.in › python-if-else-practice-programs
Python If Else Practice Programs, Exercises - SQA Tools
May 29, 2025 - Ask the user for years served and check whether an employee is eligible for a bonus or not. Input = Enter Years served: 5 Output = You are eligible for a bonus ... 51). Take values of the length and breadth of a rectangle from the user and check ...
🌐
TutorialAICSIP
tutorialaicsip.com › home › xi practicals › if-elif-else python exercises class11
if-elif-else python exercises Class11 - TutorialAICSIP
August 18, 2025 - Dear Students, if-elif-else python ... Class11 [1] The given number is odd or even. n = int(input("Enter any number:")) if n % 2!=0: print("No is odd") else: print("No is even") [2] The given number is positive or nega...
🌐
Pythonista Planet
pythonistaplanet.com › examples-of-conditional-statements-in-python
17 Python if-else Exercises and Examples – Pythonista Planet
May 26, 2022 - Conditional statements are pretty useful in building the logic of a Python program. The syntax of conditional statements is as follows: if condition : statements elif condition: statements else: statements
🌐
GitHub
github.com › Asabeneh › 30-Days-Of-Python › blob › master › 09_Day_Conditionals › 09_conditionals.md
30-Days-Of-Python/09_Day_Conditionals/09_conditionals.md at master · Asabeneh/30-Days-Of-Python
user = 'James' access_level = 3 if user == 'admin' or access_level >= 4: print('Access granted!') else: print('Access denied!') 🌕 You are doing great.Never give up because great things take time. You have just completed day 9 challenges and you are 9 steps a head in to your way to greatness. Now do some exercises for your brain and muscles.
Author   Asabeneh
🌐
Codesolid
codesolid.github.io › solutions › BooleanExpressionsExercises.html
Python If/Else and Booleans: Examples and Practice Questions — Python In Practice
These are the solutions for the exercises in Boolean Expressions in Python: Beginner to Expert. For the runnable exercises without the solutions, this notebook. For each of the following questions, give the best answer. You can assume all code is indented/aligned correctly at the left even if it appears indented slightly in the question text. 1. The following Python code contains one or more errors. How would you correct them? water_level = 5 if water_level > 3 print("Open flood gates") else print("Normal operations")
🌐
Learn with Yasir
yasirbhutta.github.io › python › docs › if-elif-else › practice-and-progress › exercises-if-elif-else.html
Python if‑elif‑else Exercises – Practice Conditional Logic | Learn with Yasir
Practice Python if‑elif‑else statements with beginner-friendly exercises. Strengthen your understanding of conditional logic, syntax, and control flow with hands-on coding problems.