Why wont this work | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why wont this work

X = input("") Print(x) If x == yo: Print("hi") Else: Print("ok")

12th Nov 2016, 3:17 PM
billy
2 Answers
+ 1
Let me type the correct code: x = input("") print(x) if x == "yo": print("hi") else: print("ok") Now read and check. The variable's name is x and must be always written in lower cases, becuase the language is case sensitive (X is recognized as another variable). The first letter of the functions are lower cases too. The instructions into an if statement must be indented, otherwise are out of it. "yo" must be between quotes, otherwise is recognized as a variable by the interpreter. The keywords (if, else) must be lower case too.
12th Nov 2016, 3:54 PM
Gleb Golov
Gleb Golov - avatar
+ 1
first of all u must define x not X ( X have another value ).. and "yo" must be between quotes. good luck bro 😉
12th Nov 2016, 4:16 PM
Baraa AB
Baraa AB - avatar