Advertisement
ShaunakVids

6.5 Squares and Cubes Calculator

Sep 24th, 2024
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. #Squares and Cubes Calculator
  2.  
  3. num = int(input("Enter your number: "))
  4.  
  5. print("\nEnter 1 for squaring your inputted number.")
  6. print("Enter 2 for cubing your inputted number.")
  7.  
  8. opr = int(input("\nEnter your desired request number: "))
  9.  
  10. if opr == 1:
  11.     sqr = (num*num)
  12.     print("The square of your number is: ",sqr)
  13.  
  14. elif opr == 2:
  15.     cube = (num*num*num)
  16.     print("The cube of your number is: ",cube)
  17.  
  18. else:
  19.     print("You inputted an invalid request.")
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement