Hier ist der Code: < /p>
Code: Select all
# calculator practice but with functions
# importing the necessarymodules
import math
import random
import time
# defining the user input
user_input = int(input("Enter a number: "))
time.sleep(1)
print("Please wait..")
time.sleep(4.5)
# creating the "math operators" object
class Math_op:
def __init__(self, minus, add, divide, mult):
self.minus = minus
self.add = add
self.divide = divide
self.mult = mult
# assigning each parameters to each of it's correct equation
minus = user_input - computer_input
add = user_input = computer_input
divide = user_input / computer_input
mult = user_input * computer_input
# making so that it chooses a random symbol every time user enter their number.
list = # code was not finished here because i was confused
computer_input = random.randint(1, 100)
print(computer_input)