python学习day02
一、循环
# 1、循环
"""
while True:
print('人生苦短,我用PYTHON。')
"""
#2、while 后加条件
"""
while 1>0 and 2>1:
print('人生苦短,我用PYTHON。')
"""
#3、输出1-10不包含7
a=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 "5482857+cqxiayu@user.noreply.gitee.com"
创建 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
浙公网安备 33010602011771号