文章目录
- 正文
- 转换单位
- 观察模式
- 数字处理
- 字符串处理
- 写在最后
- END
正文
转换单位
import sys
import math# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.n = int(input())
for i in range(n):e = int(input())print(int(e*7.5+700))
观察模式
import sys
import math# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.n = input()print(n[-1])
数字处理
import sys
import math# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.start_num = int(input())
lines_num = int(input())for i in range(lines_num):inputs = input().split()calc = inputs[0]n = int(inputs[1])if calc == 'ADD':start_num += nif calc == 'SUB':start_num -= nif calc == 'MULT':start_num *= nif calc == 'DIVBY':start_num /= n
print(int(start_num))
字符串处理
import math
import sys# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.s = input()mys = []
# mys = [c + c.lower() if c.isupper() else c + c.upper() for c in s if c.isalpha()]for c in s:if c.isalpha():mys.append(c + c.lower() if c.isupper() else c + c.upper())else:mys.append(c)
print("".join(mys))
写在最后
欢迎技术类的问题到这里提出,我会逐个解答