How do you use the if function to say stuff like if x=y do this? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do you use the if function to say stuff like if x=y do this?

8th Mar 2019, 3:57 PM
Diogo Beijinha
6 Answers
+ 5
Your code should be like this Operating_System = "Windows10" if Operating_System == "Windows10": print("OS updated") else: print("please update OS") ERROR 1.You have to enclose strings with quotes 2.You have to use colons after if and else statements
8th Mar 2019, 4:33 PM
Seniru
Seniru - avatar
+ 3
if x == y: #TODO Don't forget to take this course https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2277/
8th Mar 2019, 4:10 PM
Seniru
Seniru - avatar
+ 2
Diogo Beijinha can you post the code here so we can figure out what happm actually
8th Mar 2019, 4:18 PM
Seniru
Seniru - avatar
+ 1
Seniru Pasan excuse all my mistakes XD.. I just started out python and it's my first time learning a programming language.. open to all the help I can get https://code.sololearn.com/cO7z7249hSk2/?ref=app
8th Mar 2019, 4:25 PM
Diogo Beijinha
+ 1
Seniru Pasan thank you so much! It finally worked. I completely forgot about that
8th Mar 2019, 4:41 PM
Diogo Beijinha
0
Seniru Pasan but I've tried doing if windows10 == windows10 print updated and it gives a syntax error.. I've tried with and without quotation marks and it always gives a syntax error
8th Mar 2019, 4:17 PM
Diogo Beijinha