🌈个人主页: Aileen_0v0
🔥热门专栏: 华为鸿蒙系统学习|计算机网络|数据结构与算法
💫个人格言:“没有罗马,那就自己创造罗马~”
print函数默认以空格分隔,换行结尾。
print("H","G",110)
print("H","G",110)
print("H","G",110)
默认以空格分隔(sep),默认以换行结尾(end)
print("H","r",123,sep="+",end="?")
print("H","r",123,sep="——")
print("H","r",123,end="Apple")
print("111")
#字符串拼接
print("aaaa""bbbb")
#设置间隔符
print("www","lanqiaobei","cn",sep=".")
海伦公式已知三边求三角形面积
#海伦公式已知三边求三角形面积
a = int(input())
b = int(input())
c = int(input())
p = (a + b + c) / 2
s = (p*(p-a)*(p-b)*(p-c))**(1/2)
print(6)
运算符的使用
a = 5
b = not a #False
c = not b #True
d = not(a and c) #False
e = ((c-1) or (d+1)) # 0 ro 1 : True
print(b,c,d,type(e))
print(e)
练习一
a,b,c= map(int,input().split())
A= a==100 or b == 100 or c == 100
B=(a > 90 and b > 90) or (a > 90 and c > 90) or (b > 90 and c > 90)
C= a>80 and b>80 and c>80
if A or B or C:
flower += 1
print(A,B,C)
print(flower)
练习二
# 四年一闰;百年不闰,四百年再闰
year = int(input())
if year % 4 == 0 and year % 100 != 0:
print(f"{year}是闰年")
elif year % 400 == 0:
print(f"{year}是闰年")
else:
print(f"{year}是平年")