Trying to compare string values in an if statement - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Trying to compare string values in an if statement (/thread-40306.html) |
Trying to compare string values in an if statement - israelsattleen - Jul-08-2023 I am doing a tutorial where i get some string data input lbsOrKgs = input ("is it in lbs or kgs") now after getting that input all i want to do is write a comparison if lbsOrKgs == ("lbs) or lbsOrKgs = ("kgs"): print ("cool) Getting error? Please help me understand. Thank you. RE: Trying to compare string values in an if statement - deanhystad - Jul-08-2023 == is comparison, = is assignment. Quotes come in pairs. Some of yours do not match up. Please use python tags when posting code, otherwise the indenting is lost. |