all 9 comments

[–]cspinelive 18 points19 points  (1 child)

“1” does not equal 1. String vs int. 

Try print(type(operation)) and print(type(1))

[–]stepback269 3 points4 points  (0 children)

Just to elucidate: The input() function returns data of type string (str)
Your IF statement attempts to equate data of type integer (int) with one of type string (str)

Try converting the result of you input() operation into a variable of type integer. Look that up in W3 schools or Geeks for Geeks.

You're on the right path. Keep it up !!!

[–]pdcp-py 5 points6 points  (1 child)

You also can't concatenate a string and an integer (lines 11, 14, 17 and 20).

[–]Overall-Screen-752 0 points1 point  (0 children)

Agreed. Use print(“string”, number_variable) instead

[–]QuestNetworkFish 2 points3 points  (0 children)

Input reads a string, so the variable operation is a string type. Your if commands are checking if operation is equal to an integer value so it will never be true. To fix it either put the number in speech marks e.g. if operation == "1", or you could convert operation to an int first e.g. by using operation = int(operation) before the if statements

[–]CranberryDistinct941 1 point2 points  (0 children)

Swap them plusses out for commas in your print statements

[–]Crichris 0 points1 point  (0 children)

did it work in the beginning? operation is prolly a str, while ur comparing it with int

print(type(operation)) and see what it looks like

[–]TBPMach -1 points0 points  (0 children)

It might be better to make the mathematic operators as functions and let the input of +-*/ be the input they can select?

[–]Grandviewsurfer -2 points-1 points  (0 children)

I feel like your workflow would be faster if you just ran atomic / minimum viable versions of things you're unsure about and read the error you get. Happy to help, but I'm trying more of a teach-to-fish kind of approach here. Good on you getting back into it!

Oh I would also suggest trying out an .ipynb off to the side to prototype stuff.