Help with if/for/while statements in Python
Let's say I do x = "Are you cool?" and then
if x = "yes"
Whenever I try something like this I get a syntax error. Can anyone help? Thanks so much.
You'll need to use conditionals (
if), and an
input to get input from the user.
What's the syntax error? Here's a sample piece of code:
x = input("Ask a question ") if x == "something": print("Something") # add rest of code here
you need to do:
x = "Are you cool?" if x == "yes": print("Congrats")
and also if you want to ask the user are you cool then you need a input statement not defining a variable. So you would do
x = input("Are you cool?") if x == "yes": print("Congrats")