Halp | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Halp

So I made a sentence generator it works fine btw and I want there to be a right answer that comes with the output as true if not the right combination of words the output is false but if it guesses right it won’t say true I’m using this .... If choices == str(“yo m8 wassup”): Print(True) elif choices is not == str(“yo m8 wassup”) Print(False)

20th Sep 2018, 5:10 AM
Alexis Larios
Alexis Larios - avatar
2 Answers
+ 6
This works better and is more readable: if choices == "yo m8 wazzup": print(True) else: print(False) In case you're wondering, if you *really* wanted to use an elif (there is no need, though), you should do: if choices == "yo m8 wazzup": print(True) elif choices != "yo m8 wazzup": print(False) But actually, you could achieve the same in one line: print(choices == "yo m8 wazzup")
20th Sep 2018, 6:28 AM
Eduardo Petry
Eduardo Petry - avatar
+ 2
ty man ill give it a try
20th Sep 2018, 6:34 AM
Alexis Larios
Alexis Larios - avatar