Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def max_num (num1,num2,num3):
- if num1 >= num2 and num1 >= num3 :
- return num1
- elif num2 >= num1 and num2 >= num3:
- return num2
- else:
- return num3
- print(max_num(30,400,5))
- def calculation():
- print("Let's " + command + " some numbers")
- if command == "add":
- input1 = input("Number 1 : ")
- input2 = input("Number 2 : ")
- result = int(input1) + int(input2)
- print(str(result))
- elif command == "subtract":
- input1 = input("Number 1 : ")
- input2 = input("Number 2 : ")
- result = int(input1) - int(input2)
- print(str(result))
- elif command == "total":
- result = 0
- how_many = input("how many numbers do you want to add? ")
- for loop in range(int(how_many)):
- number = input("Enter number " + str(loop) + ": ")
- result = result + int(number)
- print(str(result))
- elif command == "average":
- result = 0
- how_many = input("How many numbers do you want to enter? ")
- for loop in range(int(how_many)):
- number = input("Enter number " + str(loop) + ": ")
- result = result + int(number)
- average = int(result) / int(how_many)
- print(str(average))
- loop = True
- while loop == True:
- print("Hi,i'm Oracle your personal bot")
- command = input("How can i help? ")
- if command == "add" or command == "subtract" or command == "total" or command == "average":
- calculation()
- elif command == "bye" or command == "exit" or command == "stop":
- loop = False
- else:
- print("wrong entry / operator")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement