一、循环
# 1、循环
"""
while True:
print('人生苦短,我用PYTHON。')
"""
#2、while 后加条件
"""
while 1>0 and 2>1:
print('人生苦短,我用PYTHON。')
"""
#3、输出1-10不包含7a=1
while a<=10:
if a!=7:
print(a)
else:
pass
a +=1
a=1
while a<=10:
if a==7:
a +=1
continue
print(a)
a +=1
#4、作业:
#1-100奇数相加
count = 1
s = 0
while count<=100:
if count%2==1:
s +=count
count +=1
print(s)
#1-2+3-4+5-6....-100
count = 1
s = 0
while count<=100:
if count%2==1:
s +=count
else:
s-=count
count +=1
print(s)
二、字符串格式化
注意:input输出的是字符串
name = input('姓名:')
age = input('年龄:')
age = int(age)
s = '%s的年龄是%d' %(name,age,)
print(s)
name='alex'
#注意输出%要使用%%
tmp = '%s手机电量100%%'%(name)
print(tmp)
name = input('姓名:')
age = input('年龄:')
job = input('工作:')
s = """
------------info------------
name:{}
age:{}
job:{}
------------end------------
""".format(name,age,job)
print(s)
三、判断条件
and/or/not
1、and第一个判断为True,值为第二个
and第一个判断为False,值为第一个
2、or第一个判断为True,值为第一个
or第一个判断为False,值为第二个
3、not的值为True/False
4、()>not>and>or,判断语句从左到右
四、git安装、码云注册、开通博客
上传码云注意:
git init
git add .
git commit -m "name"
Git 全局设置:
git config --global user.name "cqxiayu"
git config --global user.email "[email protected]"
创建 git 仓库:
mkdir learnday01
cd learnday01
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin https://gitee.com/cqxiayu/learnday01.git
git push -u origin master
已有仓库?
cd existing_git_repo
git remote add origin https://gitee.com/cqxiayu/learnday01.git
git push -u origin master
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。