Created
February 3, 2022 22:38
-
-
Save Mathsmaniac/22ed74ef3136ead037eb62161fbe162d to your computer and use it in GitHub Desktop.
Exercises to recap year 11 that are boring and easy and I didn't finsih because I have better things to do
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import webbrowser | |
def biggest_number(): | |
while True: | |
try: | |
num1 = int(input("Enter the first number: ")) | |
num2 = int(input("Enter the second number: ")) | |
except ValueError: | |
print("Those are not numbers, try again ") | |
continue | |
if num1 == 0 or num2 == 0: | |
break | |
if num1 == num2: | |
print("The numbers are equal") | |
else: | |
print("The larger number is {}".format(max(num1, num2))) | |
def sum_number(): | |
summ = 0 | |
for i in range(20, 26): | |
summ += i | |
print(i) | |
print(f"sum is {summ}") | |
choice = input("Choose either 'biggest' for biggest number or 'sum' for sum number: ") | |
if choice.lower() == "sum": | |
sum_number() | |
elif choice.lower() == "biggest": | |
biggest_number() | |
else: | |
print("That was not a valid input, I am extremely disappointed in you") | |
print("Now you are going to have to run me again as punishment") | |
webbrowser.open("https://www.youtube.com/watch?v=dQw4w9WgXcQ") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment