Ⅳ: Job

1, the user enters the name, age, work, hobbies, and then printed in the following format

------------ info of Egon -----------
Name : Egon
Age : 22
Sex : male
Job : Teacher
------------- end -----------------

name=input('Name:')
age=input('Age:')
sex=input('Sex:')
job=input('Job:')
print('------------ info of Tony -----------')
print('Name:%s\nAge:%s\nSex:%s\nJob:%s'%(name,age,sex,job))
print('------------- end -----------------')

2, the user enters the account password, the program is determined separately account and password are correct, the correct output True, False error output can be

name = "qujiu"
username=input("请输入您的账号")
print(username == name)
counter = '12345'
password=input("请输入您的密码")
print(password == counter)

3, make a note of the computer in advance egon at the age of 18 years, wrote a program to guess the age of the user is required to enter the suspect's age, and the age of the program to get user input compared with egon's age, you can output a comparison result

int_age = 18
age=input('请输入egon的年龄?')
print(int_age == age)

4, taken from the database program 10000 data, intends to display the page, but a page display up to 30 data, please select the appropriate arithmetic operators, calculations show that over 30 pages of data a total of how many? Finally, a few display data?

page= 10000 // 30
print(page)
last_page= 10000 - 30 * page
print(last_page)

5, egon this year is 18 years old, please assign computing egon teacher after 3 years of age incremental

age=18
age += 3
print(age)

6, the one-time value 10 is assigned to the variable names x, y, z

x=10
y=x
z=y
print(x,y,z)

7, add the following values ​​related to the corresponding variable name that it should, you know

dsb = "egon"
superman = "alex"

dsb = "egon"
superman = "alex"
dsb,superman=superman,dsb
print('dsb="%s"\nsuperman="%s"'%(dsb,superman))

8, we just want to extract out sucker list, disposable assigned to the corresponding variable name to

names=['alex_sb','wusir_sb','oldboy_sb','egon_nb','lxx_nb','tank_nb']

names=['alex_sb','wusir_sb','oldboy_sb','egon_nb','lxx_nb','tank_nb']
sb1,sb2,sb3,*_ =names
print(sb1,sb2,sb3)

Guess you like

Origin www.cnblogs.com/qujiu/p/12422903.html