Views : 172,693
Genre: Education
Date of upload: Mar 1, 2024 ^^
Rating : 4.973 (5/737 LTDR)
RYD date created : 2024-05-04T08:21:57.446984Z
See in json
Top Comments of this video!! :3
Why is there a swastika at 2:32? Kids watch this!
4 |
1:25 technically both are wrong
1 |
def add(x, y):
return x + y
def subtract(x, y):
return x - y
def multiply(x, y):
return x * y
def divide(x, y):
if y == 0:
return "Error: Cannot divide by zero!"
else:
return x / y
print("Welcome to Calculator App!")
while True:
print("\nOperations:")
print("1. Addition")
print("2. Subtraction")
print("3. Multiplication")
print("4. Division")
print("5. Exit")
choice = input("Enter operation number (1/2/3/4/5): ")
if choice in ('1', '2', '3', '4'):
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
if choice == '1':
print("Result:", add(num1, num2))
elif choice == '2':
print("Result:", subtract(num1, num2))
elif choice == '3':
print("Result:", multiply(num1, num2))
elif choice == '4':
print("Result:", divide(num1, num2))
elif choice == '5':
print("Exiting...")
break
else:
print("Invalid Input") Sorry for the off-topic thing but whoever knows what coding or programming language it is wins a like
|
@MonkeyQuiz.
2 months ago
Who answers more than 30 questions correctly? 😊
7 |