Python Learning notes: 1. First knowledge of Python

Source: Internet
Author: User

4.26 today's content outline 1. First knowledge of computers. CPU memory Hard disk 2.python The history of 3.python and the category of 5.python that affect 4.python 6. Variable 7. Constant 8. Note 9. Basic number Type First knowledge 10.input11.if12.while  An equal sign is an assignment operation, and the two equals sign is the comparison value   ##### #今日笔记 ##### #今日内容大纲. 1, the first knowledge of the computer. CPU memory, HDD, OS CPU: Brain, CPU, computing center. Memory: Temporarily stores data for CPU operation.      Advantages: Fast reading speed.      Disadvantages: Small capacity, high cost, power loss disappears. Hard disk: Long-time storage of data, large amounts of data. 500G,1T,2T, big movies, small videos.      Advantages: Large capacity, low cost, power failure does not disappear. ,      disadvantages: slow reading speed. Operating system: Provisioning, operation of each hardware.     windows,linux,cenos,mac,。。。   2,python first knowledge.  3,python history to influence.     python: Beautiful, clear and simple.     1 big difference:         python2x: The source code is not standardized, source confusion, duplicate codes more.         python3x: Re-source code, code specification, beautiful, clear, simple. Classification of                 4,python. The compiled:     compiles the code all at once into a two-tier system and then runs.      Advantages: High execution efficiency.      Disadvantages: Slow development, not cross-platform.    &nBSP; Representative language: C. The explanatory:     code is interpreted line by row, interpreted as binary, and then run.      Advantages: The development of high efficiency, third-party libraries, can cross-platform.      disadvantage: Low execution efficiency.      representative Language: the type of Python.    5,python.  5.5 run the first python file:     python space file path, enter. &NBSP;&NBSP;&NBSP;&NBSP;PYTHON2X: The default encoding method ascii,              Show Chinese: First line: #-*-Encoding:utf-8-*-. &NBSP;&NBSP;&NBSP;&NBSP;PYTHON3X: The default encoding method is Utf-8.     python2x:print ' content ' Print (' content ')     python3x:print (' content '). &NBSP;&NBSP;&NBSP;&NBSP;6, variable.      #变量: Store the computed intermediate results for subsequent code use.      variable setting rule:         1, must be a letter, the number underline any combination.         2, cannot be the beginning of a number.         3, cannot be a keyword in python.         [' and ', ' as ', ' assert ', ' Break ', ' class ', ' Continue ',          ' def ', ' del ', ' elif ', ' Else ', ' except ', ' EXEC ',          ' finally ', ' for ', ' from ', ' global ', ' if ', ' Import ',         ' in ', ' is ', ' Lambda ', ' not ', ' or ', ' pass ', ' print ',         ' raise ', ' return ', ' Try ', ' While ', ' with ', ' yield ']        4, the variable cannot be Chinese. &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;5, the variable cannot be too long.         6, variables have a descriptive nature.         ageofoldboy = 56         numberofstudents = 80         #下划线          age_of_oldboy = 56        number_of_students = 80# constant: The amount that remains constant. The default all uppercase variable is a constant. # ID number, pi, #注释. # help you understand other people's code and recall your own code. #单行注释: # Multi-line comment ' ' commented content '    ' "" Annotated Content ""   #基础数据类型: int number, Integer. Used for calculations.+-*/%//str; string. In Python, it is the string that is quoted in quotation marks.     print (' This is a string ')     print ("This is a string")      msg = "     before the moon light,     doubt is ground frost."      ' ' String: Can be added, can be multiplied. STR + str: concatenation of strings. Print (msg) multiplication: str * intmsg = ' strong ' #print (MSG * 8)   #bool   true False two states: The true or false of the judgment code.   #print (3 > 2) #print (3 > 4)   #print (' true ') #print (True) # to determine what the data type of this object is () #print (' True ', type (' true ') )) #print (True,type (True))   10,input user input.    11,if. Other languages:     if (condition) {result}if condition:     result      12,while. #while终止循环:     1, change the conditions.     2,break. (Ends the loop directly.) Keyword: break,        continue, end the loop and continue to the next loop.  ##### #今日代码 #######-*-encoding:utf-8-*-# print (' China hello ') ' Print (1+2+3+6+7+8+101) print ((1+2+3+6+7+8+101) *3/5) Print (((1+2+3+6+7+8+101) *3/5) *4/8)  a = 1+2+3+6+7+8+101b = a*3/5c = B*4/8print (c)   #变量: Store the computed intermediate results for subsequent code use. A_ = 4a*c = 3___ = 22_+ = 23_ _ = 1512e = 66 age1 = 12age2 = Age1age3 = Age2age2 = 23print (age1,age2,age3) # 12 23 12   12 "#常量: Constant amount. The default all uppercase variable is a constant. # ID number, pi, #注释. # help you understand other people's code and recall your own code. #单行注释: # Multi-line comment ' ' commented content '    ' "" "Annotated Content" ""   #基础数据类型: "" "Print (' This is a string ') print (" This is a string ")  msg =" The bed before the moonlight, Suspicion is ground frost. "Print (msg)" "" &NBSP;MSG1 = ' old boy education ' MSG2 = '     is the best training institution ' #print (MSG1+MSG2) msg = ' strong ' #print (MSG * 8)   #bool   true False two states: The Judgment code is true or FALSE.   #print (3 > 2) #print (3 > 4)   #print (' true ') #print (True) # to determine what the data type of this object is () #print (' True ', type (' true ') ) #print (True,type (True)) "name = input (' Please enter your name: ') Age = input (' Please enter your Age: ') print (Name,age,type (name), type (ages)) '   #if # Standalone if ' Print (111) If 3 > 2:    print (666) print (333) ' #if Else ' ' name = input (' Please enter your name: ') if name = = ' Rajah ':     print (' Old iron, no problem ') else:    print (' Sick to cure ....')   #if elif ... num = int (input (' Please enter you have to select: ')   # str---> int str all consist of numbers if num = = 4:&NBSP;&NBSP;&NBSP;&NB Sp;print (' Lunch me please ') elif num = 5:    print (' Dinner I Please ') elif num = 6:    print (' Big health , walk ') ' #if elif ... else ' ' num = Int (input (' Please enter ' you have to select: ')   # str---> int str all consist of numbers if num = = 4:&NBSP;&NBSP;&N Bsp; print (' Lunch me please ') elif num = 5:    print (' Dinner I Please ') elif num = 6:     Print (' Big health, walk up ') else:    print (' give you a chance to catch ... ') '     # nested ' NUM1 = input (' Please enter the number ') if num1 = = ' 3 ':     num2 = input (' Please enter Number: ')     if num2 = = ' 5 ':         print (' Can guess right ')     else:         print (' Continue effort ')  score = Int (input ("Enter score:")) if score > 100:     Print ("I rub, highest score ...") Elif score >= 80:    print ("B") elif sCore >= 90:    print ("A") elif score >= 60:    print ("C") Elif score > = 40:    print ("D") else:    print ("Too stupid ... E ")" "while conditional:     results   while true:    print (' loyalty ')      print (' Pink Memories ')     print (' Cool ')     print (' windy up ')    flag = Truewhile flag:    print (' loyalty ')     print (' Pink Memories ')      print (' cool ')     flag = False flag = Truewhile flag:     print (' loyalty ')     print (' Pink Memories ')     print (' Cool ')      flag = False    print (' first time ')   count = 1flag = Truewhile flag:     print (count)     count = count + 1 # Count + = 1    if Count = = 101: &nb Sp;  &nBsp;   flag = False count = 1while Count < 101:    print (count)      count = count + 1 # count + = 1 count = 0while Count < 101:    print (count) &n Bsp;   count = count + 2    count = 0while Count < 101:    if Count% 2 = = 0:        print (count)     count = count + 1& Nbsp;while True:    print (111)     print (222)      Break    print (333) print (666)  while True:    print (111)      print (222)     continue    print (333) print (666) "# Break while loop calculates 1+2+3+4...+100count = 1sum = 0while true:    sum = sum + count   &nbs P;count = Count + 1    if count = = 101:break   &nbSp;print (sum)                                       

Python Learning notes: 1. First knowledge of Python

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.