1

I made a very basic calculator (im fairly new), here is the Code i'm unsure about

def main(): 
    var1 = int(input("enter number 1"))
    var2 = int(input("enter number 2"))
    operation = input ("What do you want to do? (add, subtract, multiply, divide)")
    if (var1 != int) or (var2 != int):
        print('please input a number')
        main()

im trying to make it so that if you don't input a number it will ask you to input a number and return you to the start (var1) but the if command im using isn't working, i assume because the "!= int" is not the correct way to phrase it.

instead if i put something that isn't an integer i get an actual error message and it doesn't work. any help would be appreaciated

cs95
  • 379,657
  • 97
  • 704
  • 746
  • Your assumption is correct. `var1 != int` checks whether `var1` is not equal to the `int` class; it does not check `var1`'s type. – Aran-Fey Jun 16 '18 at 19:28

0 Answers0