hw 20/3/25 11:31 AM
This commit is contained in:
parent
41aa105ca1
commit
d91b49ddcb
3 changed files with 65 additions and 0 deletions
21
py/MoreIfStatements/challenge1.py
Normal file
21
py/MoreIfStatements/challenge1.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Ask the user to enter a number
|
||||
num1 = int(input("Enter a number: "))
|
||||
|
||||
# Check if the first number is 5
|
||||
if num1 == 5:
|
||||
print("You win")
|
||||
else:
|
||||
# If the first number is greater than 5
|
||||
if num1 > 5:
|
||||
print("Too high, try again")
|
||||
else:
|
||||
print("Too low, try again")
|
||||
|
||||
# Ask the user to enter another number
|
||||
num2 = int(input("Enter another number: "))
|
||||
|
||||
# Check if the second number is 5
|
||||
if num2 == 5:
|
||||
print("You win")
|
||||
else:
|
||||
print("You lose")
|
Loading…
Add table
Add a link
Reference in a new issue