Little Turtle Python Video third lecture (class notes)

Source: Internet
Author: User

1. Variables

In other programming languages, when a variable is assigned a value to a name, the value is stored in memory, and the name is called a variable.

In Python, it's a bit different, it's more like putting a name on top of a value, so you can say that Python has no variables.

34= a + bprint (c)

2. Places to note when using variables:

You need to assign a value to the its first before using the variable.
Variable names can include letters, numbers, and underscores, but variable names cannot begin with a number.
Letters can be uppercase or lowercase, but case is different.
The equal sign (=) is the meaning of the assignment, the left is the name, the right is the value, not the reverse.

3. Use of backslashes

You can insert a single quotation mark in your code

' let\ ' s go '

There are multiple backslashes for a string to do so

str = r'c:\\w\e\r\t\y'

You can also define the backslash itself

' c:\\d '

For a string that spans multiple lines:

" " I'm Me or me, or me? "print (str)

Little Turtle Python Video third lecture (class 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.