I want to make the consumer not to type anything but the enter key. This code a start of a story I’m working on.
meow = input("\nLet's make a story!\nPress enter to start.") # don't want let people type, just make them press enter
if meow != # nothing:
# Don't print anything the consumer types!
rather than set your input to a variable, you can just go like this:
print("Let's make a story!")
input("Press enter to start")
print("Once upon a time....")
It won’t stop people from typing something else, but it won’t save what they type, and as soon as they press
enter, the next part will run
Pressing the enter/return key on an input statement returns a an empty string
''. So something like this may work:
meow = "a string with length greater than zero"
while meow != '': # while meow is not equivelant to an empty string
meow = input("\nLet's make a story!\nPress enter to start.")
This will repeatedly ask for the input untill
meow == '', in other words, someone has entered nothing and simply pressed enter. if you don’t need to store the variable try deleting it afterwords.
Oh and hey I forgot to mention this in my reply. This seems like a great story-based game learning experience! If you’re new to Python and programming in general I would highly recommend continuing the route you are on.
I hesitate to add this because I don’t want to detract from the way you’re progressing, so if you’re a beginner maybe just keep this in mind for the future. There is a Python library called The Ren’Py Visual Novel Engine. It’s a pretty awesome system for creating story-based games. You write the dialogue and narration; you can also add graphics, backgrounds, and color schemes to the story. It does however have its own little sub-language in how it integrates with Python, as such it’s not going to be a great learning tool for a Python beginner. If stories are a passion of yours though, perhaps it would be something to work your way into.