Share your repls and programming experiences

← Back to all posts
Calculator
ProCode1227 (39)

A simple calculator for simple people. Without a calculator, i don't know what i would do in math. Probably fail...

Commentshotnewtop
Bookie0 (4535)

Hi,

You should add an error message if someone types a random thing like a parentheses.

Anyway good work

Have a great day

ProCode1227 (39)

@Bookie0 Thanks for the feedback!

3465728974563 (50)

I made my own calculator a while ago and this one has solve for x. Unfortunately it doesn't actually print the equation that you put in because I'm too lazy. Anyway the link to my calculator is https://repl.it/@3465728974563/Calculator if you want to use it. The solve for x took way too long and was a pain to make and I'm still trying to find anything I can add or improve to it.

Capix (0)

Divide -> 0 -> need an error message ;)

AlexRamirez2 (105)

Delete lines 37-50, they're copies of the other lines

ProCode1227 (39)

@AlexRamirez2 ight. Can you get on The adventure thing we were doing pls. i need help

AlexRamirez2 (105)

You duplicated part of your code while updating O.o

ProCode1227 (39)

@AlexRamirez2 I am doing some code, called adventure game. Would you want to help? I see your good at python!

AlexRamirez2 (105)

@ProCode1227 Sure! I'm actually working on a zombie game right now.

ProCode1227 (39)

@AlexRamirez2 Cool! We can help each other!

AlexRamirez2 (105)

@ProCode1227 Just invite me and I'll get on soon.

AlexRamirez2 (105)

Division by zero error, I reccomend putting a try function to prevent errors from appearing and messing up the script.

try:
    choice = input("Enter choice(1/2/3/4): ")
    num1 = float(input("Enter first number: "))
    num2 = float(input("Enter second number: "))
    if choice == '1':
       print(num1,"+",num2,"=", add(num1,num2))
    elif choice == '2':
       print(num1,"-",num2,"=", subtract(num1,num2))
    elif choice == '3':
       print(num1,"*",num2,"=", multiply(num1,num2))
    elif choice == '4':
       print(num1,"/",num2,"=", divide(num1,num2))
    else:
       print("Invalid input")
except:
    print("An error occured!")
ProCode1227 (39)

@AlexRamirez2 Wow, thanks! I will put that in right now!

ProCode1227 (39)

@Alexramirez2 I think that i fixed it. Thanks again!