Advertisement
David90278

Raspberry Pi - Programming 101 - Loop

Mar 1st, 2020
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 KB | None | 0 0
  1. finished = False
  2. while finished == False:
  3.     print("Hi, I am Rotellity, the Funky Maths bot.")
  4.     command = input("How can I help?")
  5.     if command == "add":
  6.         print("let's add some numbers")
  7.         input1 = input("Pick a number, any number!>")
  8.         input2 = input("Now pick a second number>")
  9.         number1 = int(input1)
  10.         number2 = int(input2)
  11.         result = number1 + number2
  12.         output = str(result)
  13.         print("Watch me add both numbers! " + input1 + " + " + input2 + " = " + output)
  14.     elif command == "bye":
  15.         finished = True
  16.     else:
  17.         print("Sorry, I am but a simple maths bot. I do not understand your request.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement