Python Forum
Calculator only does the + function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calculator only does the + function
#3
(Jul-13-2019, 12:24 PM)ichabod801 Wrote: You need to have an expression on each side of the or. if Calcop == 1 or '+': is equivalent to if (Calcop == 1) or ('+'):. (see here for details)

Also you are casting your input to an int
Calcop = int(input("What operation do you want?\n1)+\n2)-\n3)x\n4)÷\n5)Mod\n6)Rounding\n7)Ceil\n8)Floor\n"))
Since your input can be an it or a string, just leave it as a string and adjust your tests for strings
Calcop = input("What operation do you want?\n1)+\n2)-\n3)x\n4)÷\n5)Mod\n6)Rounding\n7)Ceil\n8)Floor\n")
if Calcop == '1' or Calcop == '+':
Reply


Messages In This Thread
RE: Calculator only does the + function - by Clunk_Head - Jul-13-2019, 12:31 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020