Previous Lesson: Lesson 23. Classes in Python
What does “prompting people using Python” mean? What is “prompting” anyway? In this lesson, you’ll know how exciting it is to use this on your computer.
Create a new file: ex21.py. And type this in:
Make sure that you have typed each character exactly. You’ve already typed them all? Okay! Let’s go through this together, step-by-step:
Note: Enter yours of course.
Press ENTER.
Note: Enter your age of course.
ENTER.
Note: Enter your height of course.
Press ENTER.
Note: Enter your weight of course.
Press ENTER.
Note: Enter your favorite food of course.
And finally, press ENTER.
Particularly, this is how input() works. It’s just that simple right? But, if you’re not used to this, oh, you will now. Type this in:
By the way, we just did this so that our Terminal looks more neat and readable to the user.
Note: I’m not going to go through this step-by-step again. You just do this on your own.
See? It’s so much neater to look at, eh? You could also try this:
Remember our newline buddy? We’ve learned this from Lesson 11.
Nice. Or, you could do both the line separators and the newlines:
Let’s do this:
Isn’t this so cool to play with? You can customize this however you like. And just make sure that after you customize, let your friends and family answer this, too.
You can also check this reference for more info. So that’s it for prompting people using Python! In the next lesson, you’ll understand why we’ve discussed this. See ya!