Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #2
- number = int(input("Enter a number: "))
- if number % 2 == 0:
- print(f"{number} is even.")
- else:
- print(f"{number} is odd.")
- #3
- password = "examplepassword"
- my_password = str(input("Enter your password: "))
- if my_password == password:
- print("Welcome, your password is correct")
- else:
- print("Try again, your password is incorrect")
- #4
- grade = float(input("Enter your grade from 2.00 to 6.00: "))
- if grade < 2.50:
- print("Your grade is bad")
- elif grade < 3.50:
- print("Your grade is low")
- elif grade < 4.50:
- print("Your grade is good")
- elif grade < 5.50:
- print("Your grade is very good")
- elif grade > 5.50:
- print("Your grade is excellent")
- #5
- number = 57
- guessed_number = int(input("Enter a number between 0-100: "))
- if guessed_number > 100:
- print("The number must be between 0-100")
- elif guessed_number > number:
- print("Your number is higher, try again!")
- elif guessed_number < number:
- print("Your number is lower, try again!")
- elif guessed_number == number:
- print("Congrats, you guessed the number!")
- #6
- speed = int(input("Enter the speed which Stamat is going with: "))
- if speed <= 15:
- print("Slow")
- if speed <= 55 and speed != 15:
- print("Average")
- if speed <= 100 and speed != 55:
- print("Fast")
- if speed <= 150 and speed != 100:
- print("Ultra Fast")
- if speed > 150:
- print("Extremely fast")
- #7
- shape = str(input("Enter the type of shape whose area you want(square, rectangle, circle, triangle): "))
- a = float(input("enter side a: "))
- b = float(input("enter side b: "))
- radius = float(input("enter the radius of the circle: "))
- height = float(input("enter the height: "))
- square_area = a * a
- rect_area = a * b
- circle_area = 3.14 * (radius * radius)
- tri_area = (a * height) / 2
- if shape == "square" or "Square":
- print(square_area)
- if shape == "rectangle" or "Rectangle":
- print(rect_area)
- if shape == "circle" or "Circle":
- print(circle_area)
- if shape == "triangle" or "Triangle":
- print(tri_area)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement