目录
目录
010:计算2的幂
代码输出:
n=int(input())
if 0<=n<31:
print(2**n)
tips:
幂次用法 eg:2的5次方 >> 2**5
011:计算多项式的值
代码输出:
s = input().split()
x,a,b,c,d = float(s[0]),float(s[1]),float(s[2]),float(s[3]),float(s[4])
print("%.7f" %(a*x**3 + b*x**2 + c*x + d))
tips:
1.print里被替代的首先是字符串,所以要有引号。 “%.7f”
012:奇偶数判断
代码输入:
s = int(input())
if s % 2:
print("odd")
else:
print("even")
tips:
if 后不仅可以写算数运算,还可以用逻辑运算。相当于false和true
013:点和正方形的关系
发现了一个问题:
s = int(input().split())
TypeError: int() argument must be a string, a bytes-like o