Halp | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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 Respostas
+ 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