#输入12.345,输出543.21
num=float(input("请输入一个数:"))
'''
先将输入的数字乘1000后,旧数字的个位变成新数字的万位,旧数字的十位变成新数字的千位,旧数字的百位变成新数字的百位,
旧数字的千位变成新数字的十位,旧数字的万位变成新数字的个位,然后全部乘以0.01。
'''
gw=num*1000%10
sw=num*1000//10%10
bw=num*1000//100%10
qw=num*1000//1000%10
ww=num*1000//10000
new=(gw*10000+sw*1000+bw*100+qw*10+ww*1)*0.01
print(new)
num=float(input("请输入:"))
num1=num*1000
gw=int(num1%10)
sw=int(num1//10%10)
bw=int(num1//100%10)
qw=int(num1//1000%10)
ww=int(num1//10000)
new=gw*100+sw*10+bw+qw*0.1+ww*0.01
print(new)
a=''
print(bool(a))
b=None#none不是0,none指不存在的,0是存在的。
print(bool(b))
c=3
print(bool(c))
d=0
print(bool(d))
money=int(input("输入你的工资:"))
if money>100000:
print("买辆兰博基尼!")
if money>=10000 and money<=100000:
print("买辆大众")
else:
print("别买了")
num=int(input("请输入你的成绩:"))
if num>=90 and num<=100:
print("优秀")
if num>=80 and num <90:
print("良好")
if num>=70 and num<80:
print("普通")
if num>=60 and num<70:
print("及格")
if num<60:
print("不及格")
if num>100 or num<0:
print("成绩错误")
cet4=int(input("四级成绩:"))
if cet4>=425:
print("恭喜")
else:
print("可惜了")
num=int(input("请输入你的成绩:"))
if num>=90 and num<=100:
print("优秀")
elif num>=80 and num <90:
print("良好")
elif num>=70 and num<80:
print("普通")
elif num>=60 and num<70:
print("及格")
else:
print("不及格")
print("程序结束")
sex=input("请输入性别:")
money=int(input("请输入金额"))
if money>=3000:
if sex=="男":
print("送手表")
else:
print("送项链")
elif money>=1000:
if sex=="男" and money>=2500:
print("送水杯")
elif sex=="男" and money>=1000:
print("送啤酒")
else:
print("送化妆品")
else:
if sex=="男":
print("送打火机")
else:
print("送购物袋")
print("结束")
price=float(input("请输入西瓜单价:"))
num=float(input("请输入购买斤数:"))
money=price*num
if money>=300:
vip=input("您是否是vip用户?")
if vip=="是":
newmoney=money*0.8
else:
newmoney=money//10*10
else:
newmoney=money
sentence="您需支付%.1f元"%(newmoney)
print(sentence)
money=int(input("你有多少钱:"))#循环三要素:第一初始值
while money>=518:#循环三要素:第二判断条件(控制条件)
money-=518#循环三要素:第三步长
print("花了518块,还剩",money)
while money>=100:
money-=100
print("花了100元,还剩",money)
print("钱不够了")
num=1
sum=0
while num<=100:
sum += num
num+=1
print(sum)
num=50
i=1
while num>=30:
i *= num
num-=3
print(i)
num=50
i=0
j=1
while num>=20:
if num%3==0 and num%7==0:
print(num,"能被3和7同时整除")
i+=num
j*=num
num-=1
print("和为:",i,"积为:",j)
num=20
sum=0
while num<=100:
if num%3==0 or num%7==0:
print(num,end="\t")
sum+=num
num+=1
print(sum)
for i in range(0,10,2):#第一个数是从几开始(左闭)不填默认是0,第二个数是到几之前结束(右开)必须填,第三个数是步长,不填默认是1
print(i)
print("结束")
for i in range(10):#只输入一个数则默认是第二个数
print(i)
print("结束")
for i in range(3,10):#输入两个数默认是第一个数和第二个数
print(i)
print("结束")
sum=0
for i in range(1,101,1):
sum+=i
print(sum)
#200-300间个位数加十位数等于十的数
for i in range(200,301,1):
ge=i%10
shi=i//10%10
if ge+shi==10:
print(i)
i=1
while i<=10:
score=int(input("请输入第%d个学生的成绩:"%i))
if score<0 or score>100:
print("{:#>8}".format("输入异常"))
break
i+=1
print("结束输入")
i=1
while i<=10:
score=int(input("请输入第%d个学生的成绩"%i))
if score<0:
print("输入错误")
continue
i+=1
print("结束")
i=1
while i<=5:
j=1
while j<=20:
if j>=1 and j<=5:
print("*",end="")
j+=1
elif j>=6 and j<=10:
print("#", end="")
j += 1
elif j >= 11 and j <= 15:
print("*", end="")
j += 1
else:
print("#",end="")
j+=1
print()
i+=1
i=1
while i<=5:
j=1
while j<=10:
if j<=5:
print("#",end="")
j+=1
else:
print("*", end="")
j += 1
print()
i+=1
i=1
while i<=5:
j=1
while j<=i:
print("*",end="")
j+=1
print()
i+=1
i=5
while i<=5 and i>=1:
j=1
while j<=i:
print("#",end="")
j+=1
print()
i-=1
i=int(input("请输入一个数:"))
j=2
while j<i:
if i%j==0:
print("%d不是质数"%i)
break
j+=1
else:
print("%d是质数"%i)
line=1
while line<=9:
colume = 1
while colume<=line:
print("%d*%d=%d"%(colume,line,colume*line),end="\t")
colume+=1
print()
line+=1
i=1#行数
while i<=9:
j=1#列数
while j<=i:
print("{}*{}={}".format(j,i,j*i),end="\t")
j+=1
print()
i+=1