Stupid way to learn python (11)

Source: Internet
Author: User

Exercise 11: Asking questions

I've had a lot of print-related exercises to get you used to writing simple things, but simple things are a little boring and now it's time to keep up. All we have to do now is read the data into your program. This may be a bit difficult for you, you may not understand, but you need to believe me, regardless of the problem. Just do a few exercises and you'll understand.

The general software does the main thing is the following:

1. Input of the recipient.

2. Change the input.

3. Print out the changed input.

So far you have only printed, but you will not accept or modify the input of the person. You may not yet know what "input" means. So gossip less, let's start doing some exercise to see if you can understand. We'll give you more explanations in the next exercise.

1 #-- Coding:utf-8- -2 Print "How is old is you ?", 3Age =raw_input ()4 Print "How tall is you ?", 5Height =raw_input ()6 Print "How much does you weigh?", 7Weight =raw_input ()8 9 Print "So, you ' re%r old,%r tall and%r heavy."% (age, height, weight)
View Code

Note

Notice that I put a comma (comma) behind each line of print, right? In this case, print will not output new line breaks and end this line to the next line.

You should see the result:

Bonus points Exercise

1. Surf the web to find out what features Python Raw_input implements.

2. Can you find any other usage of it? Test the example you searched for online.

3. Write a paragraph in a similar format and change the question to your own.

4. In relation to escape sequences, think about why the last line ' 6\ ' 2 ' has a \ ' sequence inside. Single quotes need to be escaped, preventing it from being recognized as the end of a string. Have you noticed this?

Exercise Exercises

Stupid way to learn python (11)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.