Little Turtle Python Video Third lecture (notes and after-school exercise answers)

Source: Internet
Author: User

1. Rules for variable naming:

1. Variables are assigned before they are used.

2 variables can be letters, underscores, numbers, but cannot start with a number.

The 3 variables are case-sensitive and represent different meanings.

PS: In Python, you just paste the value into a variable, not a store, so you can think of no variable in Python.

2. String

The use of strings is to be noted for consistency

PS: Use of quotation marks in strings

' let\ ' s go '

Result is

3. Use of backslashes

" C:\file " Print  "c:\\file"print"C:\file\now"  Print= R"C:\file\now"print str

The result is:

Effect of the last three single quotes:

" " I'm a boy, I love life, I'm a foodie, and I'm a literary youth . " " Print str

Or

" " I am a boy,\n, I love life, \ n I am a foodie, I am still a literary youth. Print STR

The results were:

Summing up today, we learned about the use rules of variables, the meaning of strings, the backslash, and the effect of three single quotes.

4. After-school assignments:

daysperyear = 365= = = = Daysperyear * HoursPerDay * minutesperhour * Secon DsperminutePrint(Result)

Little Turtle Python Video Third lecture (notes and after-school exercise answers)

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.