Pick Apart Your User's Input (Exercise)
00:00
Your next exercise builds kind of on top of the previous one. So your task here is to pick a part your user’s input. It should write a program that you’re going to name first_letter.py
, and it should prompt the user for an input, giving you the prompt string "Tell me your password: "
and then the program should determine the first letter of the user’s input, convert that letter to uppercase, and display it back.
00:23
And then there’s an example down here that says, if the user’s input is "no"
, which is probably a good thing to say to such a prompt, then the program should display the following output, saying The first letter you entered was:
and then an uppercase N
because this is the first letter of the string that the user entered, uppercased.
00:44 And also don’t worry if your program doesn’t have any sort of error handling. So if it crashes when the user just presses Enter instead of entering anything, that’s okay for now.
00:53 For this exercise, it doesn’t matter. And if you continue down the Python Basics path, you will learn about error handling later on. For now, just focus on the string methods here.
01:03 What do you need to do to get just the first letter of the input and uppercase it and then display it back?
01:11 That’s your task for this exercise, and in the next lesson, you can watch me solve it.
Become a Member to join the conversation.