2020-01-29 19:51:07
The first week learning points
1. Course Introduction
He worked in a more experienced teacher very fast hardware company, indicating the platform and experience is very important for a person.
python more and more widely, to learn better prospects.
Teaching goals: day of the week, taught in seven months, to develop, automate, would like why why. Can develop automation platform operation and maintenance, monitoring, CMDB, Docker \ Openstack \ Zabbix and other open source software secondary development, Web chat software, BBS, blog, corporate website.
Learning Plan:
Language Basics 5-6 weeks
Network Programming 4-5 weeks, not just knowledge of python
web infrastructure development 3-4 weeks
Algorithms, design patterns 1 week
py web frame 5 weeks
Project combat 8 weeks
2. Language Fundamentals
The first to write a python program "Hello World!"
variable
Only letters, numbers and underscores
can not begin with a number
can not be used functionality, such as print
variable that is used for storing things, to prepare for access
User interaction
Formatted output three kinds of implementations
name = input("name:")
age = input("age:")
job = input("job:")
salary = input("salary:")
info ='''
---------- info of '''+ name + ''' ----------
Name:''' + name + '''
Age:''' + age + '''
Job:''' + job + '''
Salary:''' + salary + '''
'''
print(info)
name = input("name:")
age = input("age:")
job = input("job:")
salary = input("salary:")
info ='''
---------- info of %s ----------
Name:%s
Age:%s
Job:%s
Salary:%s
''' % (name,name,age,job,salary)
print(info)
name = input("name:")
age = int(input("age:"))#intger
print(type(age),type(str(age)))
job = input("job:")
salary = input("salary:")
info ='''
---------- info of %s ----------
Name:%s
Age:%d
Job:%s
Salary:%s
''' % (name,name,age,job,salary)
print(info)
name = input("name:")
age = int(input("age:"))#intger
print(type(age),type(str(age)))
job = input("job:")
salary = input("salary:")
info2 = '''
---------- info of {_name} ----------
Name:{_name}
Age:{_age}
Job:{_job}
Salary:{_salary}
''' .format(_name=name,
_age=age,
_job=job,
_salary=salary)
print(info2)
name = input("name:")
age = int(input("age:"))#intger
print(type(age),type(str(age)))
job = input("job:")
salary = input("salary:")
info3 ='''
---------- info of {0}----------
Name:{0}
Age:{1}
Job:{2}
Salary:{3}
'''.format(name,age,job,salary)
print(info3)
if、elif、else的用法
age_of_oldboy = 45
guess_age = int(input("age_of_oldboy:"))
if guess_age == age_of_oldboy:
print("Yes,you get it.")
elif guess_age < age_of_oldboy:
print("Think it bigger!")
else:
print("Think it younger!")
while循环
age_of_oldboy = 45
count = 0
while count <3:
guess_age = int(input("age_of_oldboy:"))
if guess_age < age_of_oldboy:
print("Think bigger!")
elif guess_age > age_of_oldboy:
print("Think smaller!")
else:
print("Yes,you got it.")
break
count +=1
if count == 3:
countine_confirm = input("Do you want to keep guessing..?'n'means no ,other touch yes")
if countine_confirm !="n":
count =0
else:
print("You have tried too many times..fuck off")
for循环
age_of_oldboy = 45
for i in range(3):
guess_age = int(input("age_of_oldboy:"))
if guess_age < age_of_oldboy:
print("Think bigger!")
elif guess_age > age_of_oldboy:
print("Think smaller!")
else:
print("Yes,you got it.")
break
else:
print("You have tried too many times..fuck off")
for i in range(0,10):
if i <5:
print("loop",i)
else:
continue
print("hehe")
for i in range(10):
print('--------',i)
for j in range(10):
print(j)
if j >4:
break
作业
The first blog, the role of First review the course content, the second is the accumulation of
the second landing write the interface
to enter a user name and password
to display a welcome message after successful authentication
after unsuccessful attempts to lock
the third multi-level menu
level menu
can select enter submenus
required new knowledge: lists, dictionaries
job format
the README
Blog addr
Program the Summary