Advertisement
boyan1324

23401

Oct 25th, 2023
924
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.01 KB | None | 0 0
  1. #2
  2. number = int(input("Enter a number: "))
  3. if number % 2 == 0:
  4.    print(f"{number} is even.")
  5. else:
  6.    print(f"{number} is odd.")
  7.  
  8. #3
  9. password = "examplepassword"
  10. my_password = str(input("Enter your password: "))
  11. if my_password == password:
  12.     print("Welcome, your password is correct")
  13. else:
  14.     print("Try again, your password is incorrect")
  15.  
  16. #4
  17. grade = float(input("Enter your grade from 2.00 to 6.00: "))
  18. if grade < 2.50:
  19.     print("Your grade is bad")
  20. elif grade < 3.50:
  21.     print("Your grade is low")
  22. elif grade < 4.50:
  23.     print("Your grade is good")
  24. elif grade < 5.50:
  25.     print("Your grade is very good")
  26. elif grade > 5.50:
  27.     print("Your grade is excellent")
  28.  
  29. #5
  30. number = 57
  31. guessed_number = int(input("Enter a number between 0-100: "))
  32. if guessed_number > 100:
  33.     print("The number must be between 0-100")
  34. elif guessed_number > number:
  35.     print("Your number is higher, try again!")
  36. elif guessed_number < number:
  37.     print("Your number is lower, try again!")
  38. elif guessed_number == number:
  39.     print("Congrats, you guessed the number!")
  40.  
  41. #6
  42. speed = int(input("Enter the speed which Stamat is going with: "))
  43. if speed <= 15:
  44.     print("Slow")
  45. if speed <= 55 and speed != 15:
  46.     print("Average")
  47. if speed <= 100 and speed != 55:
  48.     print("Fast")
  49. if speed <= 150 and speed != 100:
  50.     print("Ultra Fast")
  51. if speed > 150:
  52.     print("Extremely fast")
  53.  
  54. #7
  55. shape = str(input("Enter the type of shape whose area you want(square, rectangle, circle, triangle): "))
  56. a = float(input("enter side a: "))
  57. b = float(input("enter side b: "))
  58. radius = float(input("enter the radius of the circle: "))
  59. height = float(input("enter the height: "))
  60.  
  61. square_area = a * a
  62. rect_area = a * b
  63. circle_area = 3.14 * (radius * radius)
  64. tri_area = (a * height) / 2
  65.  
  66. if shape == "square" or "Square":
  67.     print(square_area)
  68. if shape == "rectangle" or "Rectangle":
  69.     print(rect_area)
  70. if shape == "circle" or "Circle":
  71.     print(circle_area)
  72. if shape == "triangle" or "Triangle":
  73.     print(tri_area)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement