I don’t understand why this code doesn’t fully work | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

I don’t understand why this code doesn’t fully work

commands = ["Lights Off", "Lock the door", "Open the door", "Make Coffee", "Shut down"] #your code goes here x = input() if x not in commands: print("Not Supported") else: print("OK")

8th Aug 2021, 8:34 PM
Wesley Li
3 Antworten
+ 9
Wesley Li , if you really have a problem, we need some more details from you: ▪︎give a clear and complete description about your task, also name tutorial and lesson number ▪︎if there are error messages please post them here ▪︎give at least one sample with input data and the expected output ▪︎also specify the programming language in a tag thanks for your understanding!
8th Aug 2021, 8:42 PM
Lothar
Lothar - avatar
+ 3
Maybe s should be lowercase in Supported print("Not supported")
9th Aug 2021, 1:30 AM
Simba
Simba - avatar
+ 2
Hi Wesley Li I tried your code and works just fine. You input must match 100% with command . May be you are getting error due to Uppercase or lowercase input.
8th Aug 2021, 8:50 PM
Iftekhar Ahmed Pranto
Iftekhar Ahmed Pranto - avatar