PokeVideoPlayer v23.9-app.js-020924_
0143ab93_videojs8_1563605_YT_2d24ba15 licensed under gpl3-or-later
Views : 252
Genre: Science & Technology
License: Standard YouTube License
Uploaded At Feb 23, 2023 ^^
warning: returnyoutubedislikes may not be accurate, this is just an estiment ehe :3
Rating : 5 (0/22 LTDR)
100.00% of the users lieked the video!!
0.00% of the users dislieked the video!!
User score: 100.00- Masterpiece Video
RYD date created : 2023-02-23T11:50:31.887103Z
See in json
@MDSAZZADAHMEDSANIL
3 weeks ago
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: Division by zero"
return x / y
def calculator():
print("Select operation:")
print("1. Add")
print("2. Subtract")
print("3. Multiply")
print("4. Divide")
while True:
choice = input("Enter choice (1/2/3/4): ")
if choice in ['1', '2', '3', '4']:
try:
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
except ValueError:
print("Invalid input. Please enter numbers.")
continue
if choice == '1':
print(f"{num1} + {num2} = {add(num1, num2)}")
elif choice == '2':
print(f"{num1} - {num2} = {subtract(num1, num2)}")
elif choice == '3':
print(f"{num1} * {num2} = {multiply(num1, num2)}")
elif choice == '4':
print(f"{num1} / {num2} = {divide(num1, num2)}")
next_calculation = input("Do you want to perform another calculation? (yes/no): ")
if next_calculation.lower() != 'yes':
break
else:
print("Invalid choice. Please select a valid operation.")
if _name_ == "__main__":
calculator()
|