Python Learning D2

Source: Internet
Author: User

Format the output. %s%d

# name = input (' Please enter name: ') # age = input (' Please enter Ages: ') # sex = input (' Please enter Gender: ') ## msg = ' My name is ' + name + ' My age is ' + ' my gender is ' + sex ' # Print (msg)  "------------info of Alex Li-----------Name  : Alex liage   : 22job   : Teacherhobbie:girl-------------End-----------------" "

#formatted output% placeholder s d#name = input (' Please enter name: ')#age = Int (input (' Please enter Ages: '))#job = input (' Please enter work: ')#hobby=input (' Please enter hobby: ')##msg = " '#------------Info of%s-----------#Name:%s#Age :%d#Job:%s#Hobbie:%s#-------------End-----------------#"% (name, name, age, job, hobby)#Print (msg)

#The second method of use#dic = {#' name ': ' Old boy ',#' age ':#' job ': ' Boss ',#' hobby ': ' Money ',# }#msg = " '#------------Info of% (name) s-----------#Name:% (name) s#Age :% (age) D#Job:% (Job) s#Hobbie:% (hobby) s#-------------End-----------------#" % dic#Print (msg)

# formatted output, in the formatted output, the mere representation of% needs to be expressed in percent.
# msg = ' My name is%s, this year%s, learning Progress 2% '% (' cool sister ', ' 18 ')
# Print (msg)

03,while Else

#while  Else when the while loop is interrupted by a break, it does not go to the ELSE program.
# count = 0 # While count <= 5: #      Count + = 1#     print ("Loop", Count)#     if count = = 4:break ## Else: #      Print ("Loop normal execution")#  print ("-----out of a while loop------")
04, operator.
# print (2 > 1 and 3 < 4 or 8 < ten and 4 > 5)
# The first case is a comparison operation before and after the logical operator
# Priority concept: () > Not > and > or, the same priority is calculated from left to right.
# Print (2 > 1 and 3 < 4 or 4 > 5 and 2 < 1)  # T#  print (1 > 2 and 3 < 4 or 4) ; 5 and 2 > 1 or 9 < 8)  # F#  print (1 > 1 and 3 < 4 or 4 > 5 and 2 > 1 and 9 > 8 or 7 < 6) # F
# The second case is a number before and after the logical operator
" " x or y if x true,return x,else y " " # Print (3 or 5) # Print (2 or 5) # Print (0 or 5) # Print ( -4 or 5) # Print (3 and 5) # Print (1 or 3 or 4 or 0) # Print (1 or 3 or 0)
# print (1 > 2 and 3 or 4)

" " conversion of numbers and BOOL values int---> BOOL  non 0 true, 0 falsebool---> int   true  1, False 0,'# print (BOOL) # Print (bool (0))
05, the first knowledge of coding.

Spy war film: Beep drops high and low level, 0101010

Storage of computer files, transfer of files with 010101010

Primary password: ASCII letters, numbers, special characters.

0000 0001 8 Bit = = 1 bytes One byte represents one character.

Character: the smallest unit that makes up the content. ABC a b C

China China

A 01100001

b 01100010

C 01100011

Universal code: Unicode

Creates an initial 16-bit two-byte representation of one character.

a:01100001 01100001

Medium: 01100011 01100001

Upgrade: 32-bit four bytes represents one character.

a:01100001 01100001 01100001 01100001

Medium: 01100011 01100001 01100011 01100001

Waste of resources.

For Unicode Upgrade: Utf-8.

Utf-8: A minimum of 8 digits to represent a character.

A:01100001 (Letters are represented by 1 bytes.) )

European script: 01100001 01100001 (Europe is represented by 2 bytes.) )

Asian text-Medium: 01100001 01100001 01100001 (Europe is represented in 3 bytes.) )

Utf-16: A minimum of 16 digits to represent a character

GBK: National standard.

a:01100001

Medium: 01100001 01100001

8 bit 1 byte

1024bytes 1kb

1024KB 1MB

1024MB 1GB

1024GB 1TB

Python Learning D2

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.