Advertisement
dan_haifa

Bot-3a

Jan 17th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. finished=False
  2. while finished==False:
  3. print("Hi, I am a Genie, your personal bot!")
  4. print("Let's do magics!")
  5. users_name=input("What is your name?")
  6. print("Hi, "+users_name+", Welcome!")
  7. command=input("How can I help ?")
  8. if command=="calc circle" or command=="crcl":
  9. print("Let's calc the area of circle!")
  10. input1=input("diameter in cm ")
  11. input2=3.14
  12. input3=4
  13. number1=int(input1)
  14. number2=float(input2)
  15. number3=int(input3)
  16. result=number1*number1*number2/number3
  17. output=str(result)
  18. print(input1+"*"+input1+"*"+"3.14"+"/"+"4"+"="+output)
  19. elif command=="calc squared" or command=="sqrd":
  20. print("Let's calc the area of squared!")
  21. input=input("side in cm ")
  22. number=int(input)
  23. result=number*number
  24. output=str(result)
  25. print(input+"*"+input+"="+output)
  26. elif command=="average":
  27. how_many=input("how many numbers>?")
  28. how_many=int(how_many)
  29. total=0
  30. for number_count in range(how_many):
  31. number=input("Enter number "+str(number_count) +"> ")
  32. total=total+int(number)
  33. result=total/how_many
  34. print("the average= "+str(result))
  35. elif command=="shopping":
  36. shopping=[]
  37.  
  38. how_many=input("how many items of shopping do you have?")
  39. how_many=int(how_many)
  40.  
  41. for item_number in range(how_many):
  42. item=input("What is item number "+str(item_number+1) +"? ")
  43. shopping.append(item)
  44.  
  45. print(shopping)
  46.  
  47. shopping=len(shopping)
  48. shopping=str(shopping)
  49. print("You have "+shopping+" items in your list")
  50. elif command=="bye":
  51. finished=True
  52. else:
  53. print("I don't understand it!")
  54. print("Bye! "+users_name)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement