Skip to content

Latest commit

 

History

History
38 lines (38 loc) · 1.76 KB

File metadata and controls

38 lines (38 loc) · 1.76 KB

< Previous       Next >


User Input

You created a secret or an important story.
Now use the input() command to let the user enter a password, or they don't get to read what you wrote!


Collecting Input
Write a prompt and save, as a string, the user's response to a password variable.
Make sure to put this code above where the story is printed.


1. Create a strong password variable.
2. Prompt the user to type the password and save their response:
password = input("What's the password?")
3. If the password is correct, display the story. Otherwise, tell them they got the password wrong, and cannot see the story.

Making it Your Own
Keep thinking how you could make your real story more secure, and only let people you want to read it see the full thing.



What would happen if you made a "fake" story and a "fake" password, so it would seem like the program worked, but it didn't output your real secret story?

Recap

  • Print a story and ask the user to type a password.
  • Use the input() command to store the user's input in the password variable.
  • Share that program with a friend, and send them your secret thoughts!