利用元组 n=tuple(input()) if n==n[::-1]: print(\else:
print(\
def isPalindrome(line): for i in range(len(line)//2): if(line[i]!=line[len(line)-i-1]): return False i+=1 return True line = input() if isPalindrome(line):
print('yes') else: print('no')
7-3 jmu-python-分段函数(10 分)
x = float(input()) line = \if x<3:
print(line.format(x,1.2)) elif x == 3:
print(line.format(x,10)) else:
print(line.format(x,2*x+1))
7-4 jmu-python-判断是否构成三角形(10 分) n1=input().split()
a1,a2,a3=int(n1[0]),int(n1[1]),int(n1[2]) if (a1+a2>a3)and (a1+a3>a2) and (a2+a3>a1): print(\else:
print(\
7-5 jmu-python-分段函数1(10 分)
import math b=\x=float(input()) if abs(x)>=300: c=b.format(x,-1) else:
c=b.format(x,pow(x,3)/math.log10(abs(x)+2.6)) print(c)
python-03-循环结构
7-2 jmu-python-九九乘法表(矩形)(10 分)
for i in range(1,10): for j in range(1,10):
print(\ print()
7-3 jmu_python_最大公约数&最小公倍数(10 分)
x,y = input().split(\x,y=int(x),int(y)
for i in range(1,min(x,y) + 1): if (y % i == 0) & (x % i == 0): gys = i
print(\辗转相除法
def gcd(a, b): while b != 0: temp = a % b a = b b = temp return a
x1,y1=input().split(\x1,y1=int(x1),int(y1)
print(\
7-4 jmu-python-猜数游戏(10 分)
from random import * s=input().split() n,x=int(s[0]),int(s[1]) seed(x) c=randint(1,10) times=0 while True: if c!=n: times+=1 else: break c=randint(1,10)
print(\
from random import * seed(10) for i in range(10): print(randint(1,10))
python-04-函数
6-1 jmu-python-函数-圆形生成器(10 分)
import math a=[]
def getCircleArea(r):
return float(math.pi*float(r)*float(r)) def get_rList(n): for i in range(n): a.append(input()) return a
/* 请在这里填写答案 */ n = int(input()) rList = get_rList(n) for e in rList: