摘要:
实例 03 """模拟超市抹零结账行为""" money_all = 56.75 + 72.91 + 88.50 + 26.37 + 68.51 #累加总计金额 money_all_str = str(money_all) #转换为字符串 print("商品的总金额为:"+money_all_str 阅读全文
posted @ 2021-09-13 23:35
苒若
阅读(33)
评论(0)
推荐(0)
摘要:
"""字符串反码""" s = input() for c in s: if 'a' <= c <= 'z': print(chr(ord('z')-(ord(c)-ord('a'))),end='') elif 'A' <= c <= 'Z': print(chr(ord('Z')-(ord(c) 阅读全文
posted @ 2021-09-13 22:45
苒若
阅读(67)
评论(0)
推荐(0)
摘要:
"""括号配对检测""" Str=input("") Left_bracket=0 Left_bracket_Z=0 Right_bracket_Z=0 for i in Str: if i== '(': Left_bracket+=1 elif i== ')': if Left_bracket>0 阅读全文
posted @ 2021-09-13 22:28
苒若
阅读(32)
评论(0)
推荐(0)
摘要:
"""快乐的数字""" def getSumofSquares(num): numStr=str(num) sum=0 digitls=[int(x) for x in numStr] for i in digitls: sum += i**2 return sum def main(): n = 阅读全文
posted @ 2021-09-13 22:18
苒若
阅读(53)
评论(0)
推荐(0)
摘要:
"""凯撒密码""" s = input("") t = "" for c in s: if 'a' <= c <= 'z': t += chr( ord('a') + ((ord(c)-ord('a')) + 3 )%26 ) elif 'A'<=c<='Z': t += chr( ord('A' 阅读全文
posted @ 2021-09-13 22:13
苒若
阅读(21)
评论(0)
推荐(0)
摘要:
"""同符号数学运算""" a = int(input())A = abs(a)b = A+10c = A-10d = A*10if a < 0: b = -abs(b) c = -abs(c) d = -abs(d)else: b = abs(b) c = abs(c) d = abs(d)pri 阅读全文
posted @ 2021-09-13 19:42
苒若
阅读(61)
评论(0)
推荐(0)
摘要:
"""天天向上的力量 B""" N = eval(input()) energy_1 = pow(1+N/1000,365) energy_2 = pow(1-N/1000,365) p = int(energy_1/energy_2) print("{:.2f}, {:.2f}, {:}".for 阅读全文
posted @ 2021-09-13 01:13
苒若
阅读(42)
评论(0)
推荐(0)
摘要:
"""照猫画虎求阶乘""" n = int(input()) j = 1 for i in range(1,n+1): j = j * i print(j) 学号:2020310143012 昵称:苒若 阅读全文
posted @ 2021-09-13 00:45
苒若
阅读(53)
评论(0)
推荐(0)
摘要:
"""字符串逆序输出""" string = input() print(string[::-1]) 学号:2020310143012 昵称:苒若 阅读全文
posted @ 2021-09-13 00:22
苒若
阅读(66)
评论(0)
推荐(0)
摘要:
"""格式化输出""" a = float(input()) print('{:.3f}'.format(a)) 阅读全文
posted @ 2021-09-13 00:11
苒若
阅读(16)
评论(0)
推荐(0)