码迷,mamicode.com
首页 > 编程语言 > 详细

python小白学习过程

时间:2020-01-29 23:31:52      阅读:97      评论:0      收藏:0      [点我收藏+]

标签:项目   模式   int   continue   变量   老师   nbsp   job   化运维   

2020-01-29   19:51:07

第一周学习要点

1、课程介绍

老师本人在多个很牛逼的公司任职经历,说明平台和经历对一个人很重要。

python应用越来越广泛,学成前景好。

授课目标:一周一天,7个月教完,能开发、自动化、想干吗就干吗。可以开发自动化运维平台、监控、CMDB、Docker \Openstack\Zabbix等开源软件二次开发、Web聊天软件、BBS、博客、企业网站等。

学习安排:

语言基础5至6周

网络编程4至5周,不仅仅是python的知识

web基础开发3至4周

算法、设计模式1周

py web框架5周

项目实战8周

2、语言基础部分

写下第一个python程序“Hello World!"

变量

只能是字母、数字和下划线
不能以数字开头
功能性的不能用,如print
变量就是用来存放东西,以备取用

用户交互

格式化输出的三种实现方式

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

作业
第一项写博客,作用一是复习课程内容,二是积累
第二项编写登陆接口
输入用户名密码
认证成功后显示欢迎信息
输错三次后锁定
第三项多级菜单
三级菜单
可依次选择进入各级子菜单
所需新知识点:列表、字典
作业格式
readme
blog addr
program summary

 

 

python小白学习过程

标签:项目   模式   int   continue   变量   老师   nbsp   job   化运维   

原文地址:https://www.cnblogs.com/walch2006/p/12241561.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!