Python code help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Python code help

start_game = input("press start") print (start_game) print ("hello") what I want is that first it will tell the user to press start without printing hello then if it press start it will print hello.also if I want to first ask the user to put start without printing hello and then it must run again the code to print hello without telling the user to press start.how can I do this?

4th Apr 2017, 5:55 PM
Shredder
Shredder - avatar
3 Answers
+ 12
@Shredder Code playground is a pretty bad place to code everything, other than HTML5, JS and CSS
4th Apr 2017, 8:47 PM
Gami
Gami - avatar
+ 9
start_game = input("press start") if start_game == "start": print("hello") So basically, as you said IF the user enter start, it will print hello... == is different from real world... In coding, when you use one equal sign, a location in memory will be assigned (this is where variable come from) to. == checks if the value is equal to "start". I recommend going to the Python course, where it tells you about if/elif/else statements. Hope it helps *_*
4th Apr 2017, 8:30 PM
Gami
Gami - avatar
0
thanks I try my complete code at pc and worked.the problem is that it isn't working at code playground
4th Apr 2017, 8:39 PM
Shredder
Shredder - avatar