Tuesday, 23 April 2024

CREAT A SIMPLE CALCULATOR

 

while True:
  name= input("please enter your name: ")
  print("your name is :" ,name )
  num1 = float(input("Enter your first number: "))
  num2 = float(input("enter your second number: "))
  print("press 1 for + \npress 2 for - \npress 3 for * \npress 4 for /")
  choice= int(input("please enter choice between 1-4 : "))
  if choice==1:
    print(num1+num2)
  elif choice==2:
   print(num1-num2)
  elif choice==3:
   print(num1*num2)
  elif choice==4:
   print(num1/num2)
  else:
   print("invalid input :")

No comments:

Post a Comment

MAKE A CALANDER

  # 1.  convert calander year and month. your choice month or year , print while True :   import calendar   year = int ( input ( "P...