Day2 course summary, day2 Summary
I.
1. Historical Origins and conversion relationships of computer coding:
The computer code is carried out in binary code 0101, with ascii code
00000001
01000001 01000010 01000011 abc ascii code is based on ascii because of many restrictions on global languages.
Unicode code:
Unicode code 16bit
English: one letter, 2 bytes
A Chinese Character in two bytes.
Unicode 16-bit:
One English byte 2 Chinese byte 2
Unicode encoding 32-bit:
English: Four bytes indicate one character
Noon: Four bytes indicate a Chinese character
2. There will be subsequent UTF-8 code,GbkCode
UTF-8: 8-bit, 1 byte.
Chinese, Asian text: 24 characters in three bytes.
GbkThe national standard. It can only be used by Chinese people. One Chinese character is represented by 16 bits and two bits.
Unit conversion:
8-bit 8bit = 1 bytes
1024 bytes = 1kB
1024KB = 1 MB
1024 MB = 1 GB
1024 GB = 1 TB
While formatting the output code: There are two ways to write:
Method 1:
Name = input ('enter YOUR name: ') age = int (input ('enter your age :')) score = int (input ('enter your score: ') msg =' MY name IS % s, % d years old this year, score is % d '% (name, age, score) print (msg)
Method 2:
Name1 = input ('enter your name: ') age1 = input ('enter your age:') score1 = input ('enter your score :') msg = 'My name is % (name) s. This year, I am % (age) s, and my score is % (score) s' \ % {'age': age1, 'name': name1, 'score ': score1} print (msg)
3. logical operators and or not;
Not> and> or
# X or y if x is True, the value is x; else: The value is y.
# Opposite to or
print(not 2 > 1 and 3 < 4 or 4 > 5 and 2 > 1 and 9 > 8 or 7 < 6)
# In not in usage rules:
C1 = "Xiao pink" c2 = "" for I in range (1, 3): pinl = input ("Please input your rating! : ") If pinl in c1 or pinl in c2: print (" the rating contains % s, % s. enter "% (c1, c2) else: print (" input successful ") break again