1.1 Cross-platform
Windows, Mac OS, Linux, WWW.
Application range of 1.2Python
Operating system
3D Animation
Web
Cloud computing
Enterprise Application
What can you learn from 1.3?
All common syntax for Python3
Object-Oriented Programming thinking
Using Modules for programming
Game programming
Computer simulation
Start Python from idle
Idle is a python shell,shell means "shell", basically, is a way to interact with the program by typing text!
We see the >>> this prompt, ta means to tell you that Python is ready, waiting for you to type Python instructions.
All right, guys, try typing in idle:
>>>print ("I Love Python")
So, if you're typing,
>>>print "I Love Python" #前妻系列
Or
>>>printf ("I love Python"); #小三系列
Let's try something new, we enter
>>>print (5+3)
or enter directly
>>>5+3
You might want to try the calculation
>>>1234567890987654321*987654321012345678
Well, let's try the input.
>>>print ("Well water" + "river")
Try it first.
>>>print ("I Love Python" * 8)
And
>>>print ("I Love python\n" * 8)
Now that the multiplication is possible, we might as well try adding.
>>>print ("I love Python" + 8)
Print ('------------------------------------')
temp = input ("Guess which number I'm thinking Now:")
guess = Int (temp)
if guess = = 8:
Print ("My grass, are you the worm in my heart?! ")
Print ("Hum, guessed and no reward!") ")
Else
Print ("Wrong pull, I now think of is 8!") ")
Print ("Game over, don't play ^_^")
"" This is the comment "" "
The variable of the episode
The variable name is like the name of our real society, when assigning a value to a name, TA is stored in memory, called a variable (variable), and in most languages it is referred to as "assigning a variable" or "storing a value in a variable".
However, Python is slightly different from most other computer languages, and TA does not store the value in a variable, more like putting the name on top of the value.
So some python programmers would say "Python" has no "variables", only "names".
Places to be aware of
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. Which means my and my two names are completely different for python.
The equal sign (=) is the meaning of the assignment, the left is the name, the right is the value, not the reverse.
It is important to note that the naming theory of local variables can take any legal name, but as a good programmer, try to give the variable a professional name:
>>>t = ' Xiao Ming '
>>>SDFDD = ' Xiao Ming '
>>>teacher = ' Xiao Ming '
String of the episode
So far, the string we have known is everything inside the quotation marks, we also call the string text, the text and the numbers are very different, let's look at the example:
>>>5+8
>>> ' 5 ' + ' 8 '
To tell Python that you're creating a string, enclose the character in quotation marks, either single or double, and the Python lady says she's not picky. But you have to be right, you can't use single quotation marks on the other side but you'll end up with double quotes.
String of the episode
What if I need a single or double quotation mark in a string?
For example I want to print the string: Let's go!
There are two ways, the first is more commonly used, is to use our escape symbol (\) to escape the quotation marks in the string:
>>> ' let\ ' s go! '
There is another way, in the after-school exercises will have an example to explain.
Raw string
It seems like a backslash is a good thing, but try printing:
>>>str = ' C:\now '
We can escape ourselves with a backslash:
>>>str = ' C:\\now '
But if there are multiple backslashes in a string:
>>>str = ' C:\Program files\intel\wifi\help '
The original string is very simple to use, just add an English letter R to the front of the string:
>>>str = R ' C:\now '
Long string
If you want to get a string that spans multiple lines, for example:
I love C,
As I love IVW,
He's applause applause.
Applause applause
Applause Applause's voice,
Always wrapped in my mind,
Long refused to disperse ...
This is what we need to use to Sanchong quote string!
This article is from the "JM" blog, please be sure to keep this source http://jiemei.blog.51cto.com/4099321/1913974
1.python Getting started to mastering