Days_9 Casting Spells on Your Code
Ari Wira Saputra
Posted on March 20, 2023
If statements support more than ==. They support inequality symbols as well. Remember those <, >, and = signs you used in math way back when? Well they are back again, but this time they look a bit different.
1. equal --> 5 == 5
2. not equal --> 3 != 5
3. greater than --> 5 > 3
4. greater than or equal to --> 5 >= 3
5. less than --> 3 < 5
6. less than or equal to --> 3 <= 5
#Nesting Dolls Code
#
#19 MARCH 2023
def exercise_1():
MyScore = int(input("Your Score: "))
if MyScore > 1000:
print("Winner!!!")
else:
print("Try again😭")
def exercise_2():
myPI = float(input("What is PI to 3dp? "))
if myPI == 3.142:
print("It's Number ", myPI)
else:
print("Try again")
def exercise_3():
score = int(input("What was your score on the test? "))
if score >= 80:
print("Not too shabby")
elif score > 70:
print("acceptable")
else:
print("Dude, you need to study more!")
def call():
exercise_1()
exercise_2()
exercise_3()
call()
💖 💪 🙅 🚩
Ari Wira Saputra
Posted on March 20, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
githubcopilot AI Innovations at Microsoft Ignite 2024 What You Need to Know (Part 2)
November 29, 2024