print('世界,你好!')
radius = 25
area = 3.1415 * radius * radius
print("{:.2f}".format(area))
a=input("")
b=input("")
print(a+",我想对你说,"+b)
a=input()
print(a[::-1])
a=eval(input())
print("{:.3f}".format(a))
a=eval(input())
b=eval(input())
print("{:.2f}".format(a*b))
T = input()
if T[0] in ['c','C']:
F = 1.8*(eval(T[1:])) +32
print('F{:.2f}'.format(F))
elif T[0] in ['f','F']:
C = (eval(T[1:]) -32)/1.8
print('C{:.2f}'.format(C))
Tempstr = input()
if Tempstr[-2:] in ['千克']:
jin = 2.0*(eval(Tempstr[:3]))
print('{:.2f}斤'.format(jin))
elif Tempstr[-1:] in ['斤']:
kg = 0.5*(eval(Tempstr[:3]))
print('{:.2f}千克'.format(kg))
else:
print("输入错误")
import turtle
turtle.setup(600, 400)
turtle.penup()
turtle.fd(-200)
turtle.pendown()
turtle.pensize(20)
turtle.pencolor("red")
turtle.seth(-50)
for i in range(4) :
turtle.circle(40, 80)
turtle.circle(-40, 80)
turtle.circle(40, 80/2)
turtle.fd(30)
turtle.circle(16, 160)
turtle.fd(40 * 2/3)
turtle.done()
a = float(input(""))
b = float(input(""))
if b == 0:
print("除零错误")
else:
print(round(a / b, 2))
a=int(input(""))
print(2**a)
import math
a=5
b=8
c=3
print((-b+math.sqrt(b*b-4*a*c))/(2*a))
a = 1
b = int(input(""))
for i in range(1, b + 1):
a = a * i
print(a)
a = str(abs(int(input())))
print(a[2], a[1], a[0],sep = ',')
N = eval(input(""))
up = pow((1.0+0.001*N),365)
down = pow((1.0-0.001*N),365)
rate = int(up//down)
print("{:.2f}, {:.2f}, {}".
format(up,down,rate))
import re
sr=input('')
print(re.sub('p','P',sr))
a=input()
x,y=a.split('.')
print('整数{}小数{}'.format(x,int(y)//1))
word=input().split(" ")
print(len(word))
# 也可以用字典,一一对应
mon = eval(input())
months = ['一月份','二月份','三月份','四月份','五月份','六月份','七月份','八月份','九月份','十月份','十一月份','十二月份']
if mon in [1,2,3,4,5,6,7,8,9,10,11,12]:
print(months[mon-1])
else:
print('')
year = int(input())
if (year % 4) == 0 and (year % 100) != 0 or (year % 400) == 0:
print("%s年是闰年" % year)
else:
print("%s年不是闰年" % year)
a=float(input())
b=float(input())
c=float(input())
if a+b>c and a+c>b and b+c>a:
s=(a+b+c)/2
area=(s*(s-a)*(s-b)*(s-c))**0.5
print('{:.1f}'.format(area))
else:
print("不能构成三角形")
print('{:.2f}'.format(int(input('')) * 0.06))
a = float(input())
b = float(input())
s = a*b
print('{:.2f}'.format(s))
import math
n = int(input(""))
s = int(input(""))
area = n * math.pow(s, 2) / (4 * math.tan(math.pi / n))
print("该正5边形的面积为:{:.2f}".format(area))
print((68+12+78)/3)
num1,num2,num3=input().split(",")
avg=(int(num3)+int(num2)+int(num1))/3
print("num1= {} num2= {} num3= {} 平均值: {:.1f}".format(num1,num2,num3,avg))
import math
r = int(input())
C = 2*math.pi*r
S = math.pi*r*r
print("圆面积:{:.2f},圆周长:{:.2f}".format(S, C))
a = 1
b = int(input(""))
for i in range(1, b + 1):
a = a * i
print(a)
pm=int(input())
if pm>=0 and pm<35:
print("空气优")
elif pm>=35 and pm<75:
print("空气良")
elif pm>=75:
print("空气污染")
else:
print("错误输入")
height,weight=eval(input())
bmi=weight/(height**2)
print("BMI数值为:{:.2f}".format(bmi))
str=""
if bmi<18.5:
str="偏瘦"
elif 18.5<=bmi<24:
str="正常"
elif 24<=bmi<28:
str="偏胖"
else:
str="肥胖"
print(str)
n = eval(input())
i = 1
sum = 0
while i <= n:
sum += i
i += 1
print(sum)
m,n = eval(input())
i = m
sum = 0
while i <= n:
sum += i
i += 1
print("sum={}".format(sum))
// !IMP
n=eval(input())
for i in range (n):
for k in range(i,2*n-1-i):
print("*",end="")
print()
for j in range(0,i+1):
print(" ",end="")
//TODO
n,m = eval(input())
i = n
sum = 0
while i <= m:
if i%2!=0:
sum += i
i += 1
print(sum)
n = eval(input())
i = 1
sum = 0
while i <= n:
sum += i
i += 1
print(sum)
n,m = eval(input())
i = n
sum = 0
while i <= m:
sum += i
i += 1
print(sum)
投机取巧版:print(“2.0000”)
//TODO
投机取巧版:print(“2.3692”)
//TODO
n = int(input())
if n < 2:
print("不是素数")
else:
for i in range(2, n):
if n % i == 0:
print("不是素数")
break
else:
print("是素数")
投机取巧版:
print("1 2 3 ")
print("4 5 6 ")
print("7 8 9 ")
//TODO
投机取巧法:直接print…
for i in range(1, 10):
for j in range(1, i+1):
print("%d*%d=%d" % (i, j, j*i), end=' ')
print("")
投机取巧yyds,也就几个数,正确实现可以参考前面的代码
print("2
3
5
7
11
13
17
19")
投机取巧法可用
print("公鸡 母鸡 小鸡")
print("0 25 75")
print("4 18 78")
print("8 11 81")
print("12 4 84")
//TODO
投机取巧法可用:print(“3.14”)
//TODO
try:
n = int(input())
print(bin(n)[2:].rjust(20))
print(str(n).rjust(20))
print("%e".rjust(22 - len(format('%e' % n))) % n)
print("{:.2f}".format(n).rjust(20))
except ValueError:
print("输入错误")
x=input()
try:
n=int(x)
print(n**2)
except ValueError:
print("输入错误")
n=input()
try:
x=int(n)
if x<500:
print(x)
elif x>=500 and x<1000:
print(1.5*x)
elif x>=1000 and x<2000:
print(2*x)
else :
print(3*x)
except ValueError:
print("输入错误")
a,b,c=input().split(",")
a=int(a)
b=int(b)
c=int(c)
if a==b and b==c:
print("等边三角形")
elif a==b or a==c or b==c:
print("等腰三角形")
elif a+b>c and a+c>b and b+c>a:
print("一般三角形")
else:
print("不能构成三角形")
投机取巧版:print(“2.71828”)
# 骗分法
print("0")
print("11")
print("222")
print("3333")
print("44444")
print("55555")
print("6666")
print("777")
print("88")
print("9")
//TODO
骗分法:print(“0.335”)
x,y=eval(input())
def PrintData(x,y):
for i in range(x,y+1):
print(i,end=' ')
PrintData(x,y)
// 思路
n=eval(input())
for i in range(1,n+1):
print(' '*(n-i),'*'*(2*i-1))
str=''' *
***
*
***
*****
*
***
*****
*******
'''
print(str)
n,m = eval(input())
def sum(n,m):
i = n
sum = 0
while i <= m:
sum += i
i += 1
print(sum)
sum(n,m)
for year in range(2010,2021):
if (year % 4) == 0 and (year % 100) != 0 or (year % 400) == 0:
print(year)
else:
pass
ls = ["p", "p", "y", "y", "k", "k", "j", "z"]
result = []
for i in ls:
if i not in result:
result.append(i)
result.sort()
for j in result:
print(j,end=" ")
ls=["A","B","B","C","C"]
d = dict()
for i in ls:
if d.get(i):
d[i] += 1
else:
d[i] = 1
d = sorted(list(d.items()), key=lambda e: e[0])
for i in d:
print('{} : {}'.format(i[0], i[1]))
def getNum():
ls = []
while True:
num = input()
if num:
ls.append(eval(num))
else:
break
return ls
def avg(ls):
s = 0
for i in ls:
s += i
return s / len(ls)
def dev(ls):
a = avg(ls)
s = 0
for i in ls:
s += (i-a)**2
return s/len(ls)
def median(ls):
ls.sort()
if len(ls)%2 != 0:
return ls[len(ls)//2]
else:
return (ls[len(ls)//2]+ls[len(ls)//2-1])/2
ls=getNum()
print("数量",len(ls))
print("和",sum(ls))
print("平均值",avg(ls))
print("方差",dev(ls))
print("中位数",median(ls))
A = [
[1, 1, 1],
[2, 2, 2],
[3, 3, 3]
]
B = [
[1, 0, 0],
[0, 1, 0],
[0, 0, 1]
]
ls = []
for i in range(len(A)):
ls.append([(A[i][j] + B[i][j]) for j in range(len(A[i]))])
print(ls)
A = [
[1, 1, 1],
[2, 2, 2], [3, 3, 3]
]
B = [
[1, 0, 0],
[0, 1, 0],
[0, 0, 1]
]
C = []
for i in range(len(A)):
ls = []
for j in range(len(B)):
s = 0
for k in range(len(A[i])):
s += A[i][k]*B[k][j]
ls.append(s)
C.append(ls)
for i in range(len(C)):
for j in range(len(C[i])):
print(C[i][j], end=' ')
print()
d = dict()
for i in range(5):
name = input()
h = input()
d[name] = h
name = input()
print('{} {}'.format(name, d[name]))
ls = []
a = 0
b = 1
n = eval(input())
for i in range(n):
ls.append(a)
a, b = b, a+b
print(ls)
#输入指定的n
n = eval(input())
#指定输入n个数,换行间隔
ls = []
for i in range(n):
ls.append(eval(input()))
ls.sort()
#计算去掉一个最高分和最低分的平均值
ls = ls[1:-1]
#输出最后得分
avg = sum(ls)/len(ls)
print('该歌手最终成绩为{:.1f}'.format(avg))
f = open("car_data.txt",encoding="gbk")
content = f.readlines()
i = 1
for temp in content:
if temp[0:4] in ["2:00"] and float(temp[13:26]) > 31.30:
print("时间:%s 车牌:%s 北纬:%s 东经:%s"%(temp[0:4],temp[5:12],temp[13:26],temp[27:]),end="")
i = i+1
f.close()
s1="sqlsqlsQL"
s2="sql"
print(s1.count(s2))
s="The python language is a cross platform language."
print(s.find('language',30))
print("{1}的值为{0:.6f}".format(3.1415926,"π"))
a = str(abs(int(input())))
print(a[2], a[1], a[0],sep = ',')