White advanced python road -day 01 acquaintance python

python software, also known as the python interpreter.

1. path: #! / usr / bin / env python

2. coding: # _ * _ Coding: utf8 _ * _

 Note: The coding is not used in the python3; Chinese python2 appear in the document, the head must be added coding.

3. Variables

  . A letters, numbers and underscores;

  . B can not start with a number;

  . c Do not use keywords as variables :

    'and','as','assert','break','class','continue','def','del','elif','else','except','exec','finally','for','from',

    'global','if','import','in','is','yield','lambda','not','or','pass','print','raise','return','try','while','with';

  . D Do not repeat the python built things: such sum.

4.input: always wait until the user enters a value, the value assigned to the variable input

  Do: alert the user to enter: User name and password

. 1 N1 = INPUT ( ' Enter Username: ' )
 2 N2 = INPUT ( ' Enter password: ' )
 . 3  Print (N1)
 . 4  Print (N2)

 

5.pass usage

  If a is equal to 1, no operation is performed; otherwise, the output hello

. 1  IF . 1. 1 == :
 2          Pass 
. 3  the else :
 . 4          Print ( " Hello " )

 

6. The basic data types

  String: quotes

      Adder: the equivalent of a few words is combined;

                Multiplication: n1 = "alex"

         n2 = n1 * 10

         Showing results: alex repeated 10 times

  Digital: Math /

     ** 2 4: 2 to the fourth power

     39% 8:39 divided by modulo 8 = 7

     39 // 8: quotient = 4

 

 

Guess you like

Origin www.cnblogs.com/yy25257821/p/12104390.html