更新 8,9 题

This commit is contained in:
Luthics 2022-10-20 21:31:00 +08:00
parent ba25d575d1
commit a1ced46784
3 changed files with 20 additions and 0 deletions

10
homework/2/8_1.py Normal file
View File

@ -0,0 +1,10 @@
from math import *
# x = input().split()
a = input()
for i in range(floor(len(a)/2)):
if(a[i]!=a[len(a)-i-1]):
print("False")
exit()
print("True")

5
homework/2/8_2.py Normal file
View File

@ -0,0 +1,5 @@
s = input()
if (s == s[::-1]):
print("True")
else:
print("False")

5
homework/2/9.py Normal file
View File

@ -0,0 +1,5 @@
x = list(map(int,input().split()))
x.sort()
a = x[0]
b = x[1]
print(round((a+b)*(b-a+1)/2))