Python Lesson Three notes

Source: Internet
Author: User

Which of the following variables is named incorrectly? Why?

(A) mm_520 (B) _mm520_ (C) 520_mm (D) _520_mm

Answer: c is incorrect, cannot start with a number


In the case of not on the machine, the following code can you guess what the screen will print?

  1. >>>myteacher = ' Little Turtle '

  2. >>>yourteacher = Myteacher

  3. >>>yourteacher = ' Night '

  4. >>>print (Myteacher)

Copy Code


A: Little Turtle

In the case of not on the machine, the following code can you guess what the screen will print?


>>> myteacher = ' Little Turtle '

>>> Yourteacher = Myteacher

>>> myteacher = ' Night '

>>> Print (Yourteacher)

Copy Code

A: Little Turtle

In the case of not on the machine, the following code can you guess what the screen will print?

>>>first = 520

>>>second = ' 520 '

>>>first = Second

>>>print (first)

Copy Code

Answer: 520 string

In addition to using the rice slash (\) for character escapes, what else can be printed: let's go! This string?

Answer: "Let's go!"

If you want to enter a backslash at the end of the original string, how can you handle it flexibly?

Answer: R ' C:\Program files\fishc\good ' \ \ '


Do you remember the first moving question we talked about? This time a variable is required to calculate how many seconds are in a year?

Daysperyear = 365HoursPerDay = 24MinutesPerHour = 60SecondsPerMinute = 60result = daysperyear * HoursPerDay * Minutesperho ur * Secondsperminuteprint (Result)

On the last mention of the long string (Sanchong quote string) in fact, in Python3 can also write this, may try, and then compare which is more convenient?

String = ("...")



This article is from the "Champion Small Lemon" blog, please make sure to keep this source http://lemonit.blog.51cto.com/6043645/1597825

Python Lesson Three notes

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.