Lao Jia happy life day5 while loop encoding format operator acquaintance

while loop infinite loop

while conditions:

print (result)

while conditions:

print (result)

else:

print (result)

break terminates the current cycle

continue out of the current cycle, the next cycle

It becomes infinite loop while loop control cycles may be achieved by changing the conditions.

E.g:

a = 10

while num >5:

print (whether)

a - 1 =

format:

% S string placeholder

% D% i numeric placeholders

f placeholder

%% Escape

E.g:

name = input ( "Please enter the name")

sex = input ( "Please enter the sex:")

job = input ( "Please enter the work:")

tell = input ( "Please enter the phone:")

info = """

--------info----------

Name:% s

Gender:% s

Work:% s

Tel:% s

--------end----------

"""

print(info%(name,sex,job,tell))

name = input ( "Please enter the name")

sex = input ( "Please enter the sex:")

job = input ( "Please enter the work:")

tell = input ( "Please enter the phone:")

info = """

-----------info----------

Name:% s

Age:% s

Company:% s

Tel:% s

------------end-----------

"""%(name,sex,job,tell)

print(info)

info = f"""

-----------info----------

Name: {input ( "Please enter the name")}

Age: {input ( "Please enter the sex:")}

Company: {input ( "Please enter the work:")}

Phone: {input ( "Enter a phone:")}

------------end-----------

"""

print(info)

Formula: f + {} string in the string to be replaced to write the content.

Operator:

Arithmetic, + - * / ** //%

Comparing> <==! = <=> =

Logic, not and or

Assignment + = - = * = / =% = ** = // =

Members in not in

Logic: and a true false take a false

After taking a whole truth

Take a former all-false

a true or a false get real

Take the whole truth before a

After taking a full false

not non

Coding acquaintance:

ascii code 256 United States, no Chinese

1 byte

gbk code (GB)

English 1 byte

Chinese 2 bytes

Unicode unicode 3.6 or later

Chinese, English is four bytes

utf-8

English one byte

Europe 2

Asian 3

win - coding gbk

linux - encoding utf-8

mac - encoding utf-8

1 byte == 8

***** 1 byte == 8 **** <==> 1B == 8b ******

1B = 8b

1KB = 1024B

1MB = 1024 KB

1GB = 1024MB

1TB = 1024GB

1PB = 1024TB

1EB = 1024PB

Guess you like

Origin www.cnblogs.com/lingege/p/11291396.html