【发布时间】:2020-12-26 00:41:00
【问题描述】:
我想要一个可以将单词转换为大写字母的程序,不管它有多少个字母。
现在我可以达到 14 个。
print(upper("hello"))
print(upper("dissatisfaction"))
说“你好”但“不满意”
这是我的程序。
我不只是想添加更多(即 15 或 16),我想要它,这样无论你去多高。
所以如果你有一个像“azertyuiopqsdfghjklwxcvbnm”这样的词,它仍然可以工作。
def upper(s):
if len(s) >= 1 and s[0] == 'a':
s = 'A' + s[1:]
if len(s) >= 2 and s[1] == 'a':
s = s[:1] + 'A' + s[2:]
if len(s) >= 3 and s[2] == 'a':
s = s[:2] + 'A' + s[3:]
if len(s) >= 4 and s[3] == 'a':
s = s[:3] + 'A' + s[4:]
if len(s) >= 5 and s[4] == 'a':
s = s[:4] + 'A' + s[5:]
if len(s) >= 6 and s[5] == 'a':
s = s[:5] + 'A' + s[6:]
if len(s) >= 7 and s[6] == 'a':
s = s[:6] + 'A' + s[7:]
if len(s) >= 8 and s[7] == 'a':
s = s[:7] + 'A' + s[8:]
if len(s) >= 9 and s[8] == 'a':
s = s[:8] + 'A' + s[9:]
if len(s) >= 10 and s[9] == 'a':
s = s[:9] + 'A' + s[10:]
if len(s) >= 11 and s[10] == 'a':
s = s[:10] + 'A' + s[11:]
if len(s) >= 12 and s[11] == 'a':
s = s[:11] + 'A' + s[12:]
if len(s) >= 13 and s[12] == 'a':
s = s[:12] + 'A' + s[13:]
if len(s) >= 14 and s[13] == 'a':
s = s[:13] + 'A' + s[14:]
if len(s) >= 1 and s[0] == 'b':
s = 'B' + s[1:]
if len(s) >= 2 and s[1] == 'b':
s = s[:1] + 'B' + s[2:]
if len(s) >= 3 and s[2] == 'b':
s = s[:2] + 'B' + s[3:]
if len(s) >= 4 and s[3] == 'b':
s = s[:3] + 'B' + s[4:]
if len(s) >= 5 and s[4] == 'b':
s = s[:4] + 'B' + s[5:]
if len(s) >= 6 and s[5] == 'b':
s = s[:5] + 'B' + s[6:]
if len(s) >= 7 and s[6] == 'b':
s = s[:6] + 'B' + s[7:]
if len(s) >= 8 and s[7] == 'b':
s = s[:7] + 'B' + s[8:]
if len(s) >= 9 and s[8] == 'b':
s = s[:8] + 'B' + s[9:]
if len(s) >= 10 and s[9] == 'b':
s = s[:9] + 'B' + s[10:]
if len(s) >= 11 and s[10] == 'b':
s = s[:10] + 'B' + s[11:]
if len(s) >= 12 and s[11] == 'b':
s = s[:11] + 'B' + s[12:]
if len(s) >= 13 and s[12] == 'b':
s = s[:12] + 'B' + s[13:]
if len(s) >= 14 and s[13] == 'b':
s = s[:13] + 'B' + s[14:]
if len(s) >= 1 and s[0] == 'c':
s = 'C' + s[1:]
if len(s) >= 2 and s[1] == 'c':
s = s[:1] + 'C' + s[2:]
if len(s) >= 3 and s[2] == 'c':
s = s[:2] + 'C' + s[3:]
if len(s) >= 4 and s[3] == 'c':
s = s[:3] + 'C' + s[4:]
if len(s) >= 5 and s[4] == 'c':
s = s[:4] + 'C' + s[5:]
if len(s) >= 6 and s[5] == 'c':
s = s[:5] + 'C' + s[6:]
if len(s) >= 7 and s[6] == 'c':
s = s[:6] + 'C' + s[7:]
if len(s) >= 8 and s[7] == 'c':
s = s[:7] + 'C' + s[8:]
if len(s) >= 9 and s[8] == 'c':
s = s[:8] + 'C' + s[9:]
if len(s) >= 10 and s[9] == 'c':
s = s[:9] + 'C' + s[10:]
if len(s) >= 11 and s[10] == 'c':
s = s[:10] + 'C' + s[11:]
if len(s) >= 12 and s[11] == 'c':
s = s[:11] + 'C' + s[12:]
if len(s) >= 13 and s[12] == 'c':
s = s[:12] + 'C' + s[13:]
if len(s) >= 14 and s[13] == 'c':
s = s[:13] + 'C' + s[14:]
if len(s) >= 1 and s[0] == 'd':
s = 'D' + s[1:]
if len(s) >= 2 and s[1] == 'd':
s = s[:1] + 'D' + s[2:]
if len(s) >= 3 and s[2] == 'd':
s = s[:2] + 'D' + s[3:]
if len(s) >= 4 and s[3] == 'd':
s = s[:3] + 'D' + s[4:]
if len(s) >= 5 and s[4] == 'd':
s = s[:4] + 'D' + s[5:]
if len(s) >= 6 and s[5] == 'd':
s = s[:5] + 'D' + s[6:]
if len(s) >= 7 and s[6] == 'd':
s = s[:6] + 'D' + s[7:]
if len(s) >= 8 and s[7] == 'd':
s = s[:7] + 'D' + s[8:]
if len(s) >= 9 and s[8] == 'd':
s = s[:8] + 'D' + s[9:]
if len(s) >= 10 and s[9] == 'd':
s = s[:9] + 'D' + s[10:]
if len(s) >= 11 and s[10] == 'd':
s = s[:10] + 'D' + s[11:]
if len(s) >= 12 and s[11] == 'd':
s = s[:11] + 'D' + s[12:]
if len(s) >= 13 and s[12] == 'd':
s = s[:12] + 'D' + s[13:]
if len(s) >= 14 and s[13] == 'd':
s = s[:13] + 'D' + s[14:]
if len(s) >= 1 and s[0] == 'e':
s = 'E' + s[1:]
if len(s) >= 2 and s[1] == 'e':
s = s[:1] + 'E' + s[2:]
if len(s) >= 3 and s[2] == 'e':
s = s[:2] + 'E' + s[3:]
if len(s) >= 4 and s[3] == 'e':
s = s[:3] + 'E' + s[4:]
if len(s) >= 5 and s[4] == 'e':
s = s[:4] + 'E' + s[5:]
if len(s) >= 6 and s[5] == 'e':
s = s[:5] + 'E' + s[6:]
if len(s) >= 7 and s[6] == 'e':
s = s[:6] + 'E' + s[7:]
if len(s) >= 8 and s[7] == 'e':
s = s[:7] + 'E' + s[8:]
if len(s) >= 9 and s[8] == 'e':
s = s[:8] + 'E' + s[9:]
if len(s) >= 10 and s[9] == 'e':
s = s[:9] + 'E' + s[10:]
if len(s) >= 11 and s[10] == 'e':
s = s[:10] + 'E' + s[11:]
if len(s) >= 12 and s[11] == 'e':
s = s[:11] + 'E' + s[12:]
if len(s) >= 13 and s[12] == 'e':
s = s[:12] + 'E' + s[13:]
if len(s) >= 14 and s[13] == 'e':
s = s[:13] + 'E' + s[14:]
if len(s) >= 1 and s[0] == 'f':
s = 'F' + s[1:]
if len(s) >= 2 and s[1] == 'f':
s = s[:1] + 'F' + s[2:]
if len(s) >= 3 and s[2] == 'f':
s = s[:2] + 'F' + s[3:]
if len(s) >= 4 and s[3] == 'f':
s = s[:3] + 'F' + s[4:]
if len(s) >= 5 and s[4] == 'f':
s = s[:4] + 'F' + s[5:]
if len(s) >= 6 and s[5] == 'f':
s = s[:5] + 'F' + s[6:]
if len(s) >= 7 and s[6] == 'f':
s = s[:6] + 'F' + s[7:]
if len(s) >= 8 and s[7] == 'f':
s = s[:7] + 'F' + s[8:]
if len(s) >= 9 and s[8] == 'f':
s = s[:8] + 'F' + s[9:]
if len(s) >= 10 and s[9] == 'f':
s = s[:9] + 'F' + s[10:]
if len(s) >= 11 and s[10] == 'f':
s = s[:10] + 'F' + s[11:]
if len(s) >= 12 and s[11] == 'f':
s = s[:11] + 'F' + s[12:]
if len(s) >= 13 and s[12] == 'f':
s = s[:12] + 'F' + s[13:]
if len(s) >= 14 and s[13] == 'f':
s = s[:13] + 'F' + s[14:]
if len(s) >= 1 and s[0] == 'g':
s = 'G' + s[1:]
if len(s) >= 2 and s[1] == 'g':
s = s[:1] + 'G' + s[2:]
if len(s) >= 3 and s[2] == 'g':
s = s[:2] + 'G' + s[3:]
if len(s) >= 4 and s[3] == 'g':
s = s[:3] + 'G' + s[4:]
if len(s) >= 5 and s[4] == 'g':
s = s[:4] + 'G' + s[5:]
if len(s) >= 6 and s[5] == 'g':
s = s[:5] + 'G' + s[6:]
if len(s) >= 7 and s[6] == 'g':
s = s[:6] + 'G' + s[7:]
if len(s) >= 8 and s[7] == 'g':
s = s[:7] + 'G' + s[8:]
if len(s) >= 9 and s[8] == 'g':
s = s[:8] + 'G' + s[9:]
if len(s) >= 10 and s[9] == 'g':
s = s[:9] + 'G' + s[10:]
if len(s) >= 11 and s[10] == 'g':
s = s[:10] + 'G' + s[11:]
if len(s) >= 12 and s[11] == 'g':
s = s[:11] + 'G' + s[12:]
if len(s) >= 13 and s[12] == 'g':
s = s[:12] + 'G' + s[13:]
if len(s) >= 14 and s[13] == 'g':
s = s[:13] + 'G' + s[14:]
if len(s) >= 1 and s[0] == 'h':
s = 'H' + s[1:]
if len(s) >= 2 and s[1] == 'h':
s = s[:1] + 'H' + s[2:]
if len(s) >= 3 and s[2] == 'h':
s = s[:2] + 'H' + s[3:]
if len(s) >= 4 and s[3] == 'h':
s = s[:3] + 'H' + s[4:]
if len(s) >= 5 and s[4] == 'h':
s = s[:4] + 'H' + s[5:]
if len(s) >= 6 and s[5] == 'h':
s = s[:5] + 'H' + s[6:]
if len(s) >= 7 and s[6] == 'h':
s = s[:6] + 'H' + s[7:]
if len(s) >= 8 and s[7] == 'h':
s = s[:7] + 'H' + s[8:]
if len(s) >= 9 and s[8] == 'h':
s = s[:8] + 'H' + s[9:]
if len(s) >= 10 and s[9] == 'h':
s = s[:9] + 'H' + s[10:]
if len(s) >= 11 and s[10] == 'h':
s = s[:10] + 'H' + s[11:]
if len(s) >= 12 and s[11] == 'h':
s = s[:11] + 'H' + s[12:]
if len(s) >= 13 and s[12] == 'h':
s = s[:12] + 'H' + s[13:]
if len(s) >= 14 and s[13] == 'h':
s = s[:13] + 'H' + s[14:]
if len(s) >= 1 and s[0] == 'i':
s = 'I' + s[1:]
if len(s) >= 2 and s[1] == 'i':
s = s[:1] + 'I' + s[2:]
if len(s) >= 3 and s[2] == 'i':
s = s[:2] + 'I' + s[3:]
if len(s) >= 4 and s[3] == 'i':
s = s[:3] + 'I' + s[4:]
if len(s) >= 5 and s[4] == 'i':
s = s[:4] + 'I' + s[5:]
if len(s) >= 6 and s[5] == 'i':
s = s[:5] + 'I' + s[6:]
if len(s) >= 7 and s[6] == 'i':
s = s[:6] + 'I' + s[7:]
if len(s) >= 8 and s[7] == 'i':
s = s[:7] + 'I' + s[8:]
if len(s) >= 9 and s[8] == 'i':
s = s[:8] + 'I' + s[9:]
if len(s) >= 10 and s[9] == 'i':
s = s[:9] + 'I' + s[10:]
if len(s) >= 11 and s[10] == 'i':
s = s[:10] + 'I' + s[11:]
if len(s) >= 12 and s[11] == 'i':
s = s[:11] + 'I' + s[12:]
if len(s) >= 13 and s[12] == 'i':
s = s[:12] + 'I' + s[13:]
if len(s) >= 14 and s[13] == 'i':
s = s[:13] + 'I' + s[14:]
if len(s) >= 1 and s[0] == 'j':
s = 'J' + s[1:]
if len(s) >= 2 and s[1] == 'j':
s = s[:1] + 'J' + s[2:]
if len(s) >= 3 and s[2] == 'j':
s = s[:2] + 'J' + s[3:]
if len(s) >= 4 and s[3] == 'j':
s = s[:3] + 'J' + s[4:]
if len(s) >= 5 and s[4] == 'j':
s = s[:4] + 'J' + s[5:]
if len(s) >= 6 and s[5] == 'j':
s = s[:5] + 'J' + s[6:]
if len(s) >= 7 and s[6] == 'j':
s = s[:6] + 'J' + s[7:]
if len(s) >= 8 and s[7] == 'j':
s = s[:7] + 'J' + s[8:]
if len(s) >= 9 and s[8] == 'j':
s = s[:8] + 'J' + s[9:]
if len(s) >= 10 and s[9] == 'j':
s = s[:9] + 'J' + s[10:]
if len(s) >= 11 and s[10] == 'j':
s = s[:10] + 'J' + s[11:]
if len(s) >= 12 and s[11] == 'j':
s = s[:11] + 'J' + s[12:]
if len(s) >= 13 and s[12] == 'j':
s = s[:12] + 'J' + s[13:]
if len(s) >= 14 and s[13] == 'j':
s = s[:13] + 'J' + s[14:]
if len(s) >= 1 and s[0] == 'k':
s = 'K' + s[1:]
if len(s) >= 2 and s[1] == 'k':
s = s[:1] + 'K' + s[2:]
if len(s) >= 3 and s[2] == 'k':
s = s[:2] + 'K' + s[3:]
if len(s) >= 4 and s[3] == 'k':
s = s[:3] + 'K' + s[4:]
if len(s) >= 5 and s[4] == 'k':
s = s[:4] + 'K' + s[5:]
if len(s) >= 6 and s[5] == 'k':
s = s[:5] + 'K' + s[6:]
if len(s) >= 7 and s[6] == 'k':
s = s[:6] + 'K' + s[7:]
if len(s) >= 8 and s[7] == 'k':
s = s[:7] + 'K' + s[8:]
if len(s) >= 9 and s[8] == 'k':
s = s[:8] + 'K' + s[9:]
if len(s) >= 10 and s[9] == 'k':
s = s[:9] + 'K' + s[10:]
if len(s) >= 11 and s[10] == 'k':
s = s[:10] + 'K' + s[11:]
if len(s) >= 12 and s[11] == 'k':
s = s[:11] + 'K' + s[12:]
if len(s) >= 13 and s[12] == 'k':
s = s[:12] + 'K' + s[13:]
if len(s) >= 14 and s[13] == 'k':
s = s[:13] + 'K' + s[14:]
if len(s) >= 1 and s[0] == 'l':
s = 'L' + s[1:]
if len(s) >= 2 and s[1] == 'l':
s = s[:1] + 'L' + s[2:]
if len(s) >= 3 and s[2] == 'l':
s = s[:2] + 'L' + s[3:]
if len(s) >= 4 and s[3] == 'l':
s = s[:3] + 'L' + s[4:]
if len(s) >= 5 and s[4] == 'l':
s = s[:4] + 'L' + s[5:]
if len(s) >= 6 and s[5] == 'l':
s = s[:5] + 'L' + s[6:]
if len(s) >= 7 and s[6] == 'l':
s = s[:6] + 'L' + s[7:]
if len(s) >= 8 and s[7] == 'l':
s = s[:7] + 'L' + s[8:]
if len(s) >= 9 and s[8] == 'l':
s = s[:8] + 'L' + s[9:]
if len(s) >= 10 and s[9] == 'l':
s = s[:9] + 'L' + s[10:]
if len(s) >= 11 and s[10] == 'l':
s = s[:10] + 'L' + s[11:]
if len(s) >= 12 and s[11] == 'l':
s = s[:11] + 'L' + s[12:]
if len(s) >= 13 and s[12] == 'l':
s = s[:12] + 'L' + s[13:]
if len(s) >= 14 and s[13] == 'l':
s = s[:13] + 'L' + s[14:]
if len(s) >= 1 and s[0] == 'm':
s = 'M' + s[1:]
if len(s) >= 2 and s[1] == 'm':
s = s[:1] + 'M' + s[2:]
if len(s) >= 3 and s[2] == 'm':
s = s[:2] + 'M' + s[3:]
if len(s) >= 4 and s[3] == 'm':
s = s[:3] + 'M' + s[4:]
if len(s) >= 5 and s[4] == 'm':
s = s[:4] + 'M' + s[5:]
if len(s) >= 6 and s[5] == 'm':
s = s[:5] + 'M' + s[6:]
if len(s) >= 7 and s[6] == 'm':
s = s[:6] + 'M' + s[7:]
if len(s) >= 8 and s[7] == 'm':
s = s[:7] + 'M' + s[8:]
if len(s) >= 9 and s[8] == 'm':
s = s[:8] + 'M' + s[9:]
if len(s) >= 10 and s[9] == 'm':
s = s[:9] + 'M' + s[10:]
if len(s) >= 11 and s[10] == 'm':
s = s[:10] + 'M' + s[11:]
if len(s) >= 12 and s[11] == 'm':
s = s[:11] + 'M' + s[12:]
if len(s) >= 13 and s[12] == 'm':
s = s[:12] + 'M' + s[13:]
if len(s) >= 14 and s[13] == 'm':
s = s[:13] + 'M' + s[14:]
if len(s) >= 1 and s[0] == 'n':
s = 'N' + s[1:]
if len(s) >= 2 and s[1] == 'n':
s = s[:1] + 'N' + s[2:]
if len(s) >= 3 and s[2] == 'n':
s = s[:2] + 'N' + s[3:]
if len(s) >= 4 and s[3] == 'n':
s = s[:3] + 'N' + s[4:]
if len(s) >= 5 and s[4] == 'n':
s = s[:4] + 'N' + s[5:]
if len(s) >= 6 and s[5] == 'n':
s = s[:5] + 'N' + s[6:]
if len(s) >= 7 and s[6] == 'n':
s = s[:6] + 'N' + s[7:]
if len(s) >= 8 and s[7] == 'n':
s = s[:7] + 'N' + s[8:]
if len(s) >= 9 and s[8] == 'n':
s = s[:8] + 'N' + s[9:]
if len(s) >= 10 and s[9] == 'n':
s = s[:9] + 'N' + s[10:]
if len(s) >= 11 and s[10] == 'n':
s = s[:10] + 'N' + s[11:]
if len(s) >= 12 and s[11] == 'n':
s = s[:11] + 'N' + s[12:]
if len(s) >= 13 and s[12] == 'n':
s = s[:12] + 'N' + s[13:]
if len(s) >= 14 and s[13] == 'n':
s = s[:13] + 'N' + s[14:]
if len(s) >= 1 and s[0] == 'o':
s = 'O' + s[1:]
if len(s) >= 2 and s[1] == 'o':
s = s[:1] + 'O' + s[2:]
if len(s) >= 3 and s[2] == 'o':
s = s[:2] + 'O' + s[3:]
if len(s) >= 4 and s[3] == 'o':
s = s[:3] + 'O' + s[4:]
if len(s) >= 5 and s[4] == 'o':
s = s[:4] + 'O' + s[5:]
if len(s) >= 6 and s[5] == 'o':
s = s[:5] + 'O' + s[6:]
if len(s) >= 7 and s[6] == 'o':
s = s[:6] + 'O' + s[7:]
if len(s) >= 8 and s[7] == 'o':
s = s[:7] + 'O' + s[8:]
if len(s) >= 9 and s[8] == 'o':
s = s[:8] + 'O' + s[9:]
if len(s) >= 10 and s[9] == 'o':
s = s[:9] + 'O' + s[10:]
if len(s) >= 11 and s[10] == 'o':
s = s[:10] + 'O' + s[11:]
if len(s) >= 12 and s[11] == 'o':
s = s[:11] + 'O' + s[12:]
if len(s) >= 13 and s[12] == 'o':
s = s[:12] + 'O' + s[13:]
if len(s) >= 14 and s[13] == 'o':
s = s[:13] + 'O' + s[14:]
if len(s) >= 1 and s[0] == 'p':
s = 'P' + s[1:]
if len(s) >= 2 and s[1] == 'p':
s = s[:1] + 'P' + s[2:]
if len(s) >= 3 and s[2] == 'p':
s = s[:2] + 'P' + s[3:]
if len(s) >= 4 and s[3] == 'p':
s = s[:3] + 'P' + s[4:]
if len(s) >= 5 and s[4] == 'p':
s = s[:4] + 'P' + s[5:]
if len(s) >= 6 and s[5] == 'p':
s = s[:5] + 'P' + s[6:]
if len(s) >= 7 and s[6] == 'p':
s = s[:6] + 'P' + s[7:]
if len(s) >= 8 and s[7] == 'p':
s = s[:7] + 'P' + s[8:]
if len(s) >= 9 and s[8] == 'p':
s = s[:8] + 'P' + s[9:]
if len(s) >= 10 and s[9] == 'p':
s = s[:9] + 'P' + s[10:]
if len(s) >= 11 and s[10] == 'p':
s = s[:10] + 'P' + s[11:]
if len(s) >= 12 and s[11] == 'p':
s = s[:11] + 'P' + s[12:]
if len(s) >= 13 and s[12] == 'p':
s = s[:12] + 'P' + s[13:]
if len(s) >= 14 and s[13] == 'p':
s = s[:13] + 'P' + s[14:]
if len(s) >= 1 and s[0] == 'q':
s = 'Q' + s[1:]
if len(s) >= 2 and s[1] == 'q':
s = s[:1] + 'Q' + s[2:]
if len(s) >= 3 and s[2] == 'q':
s = s[:2] + 'Q' + s[3:]
if len(s) >= 4 and s[3] == 'q':
s = s[:3] + 'Q' + s[4:]
if len(s) >= 5 and s[4] == 'q':
s = s[:4] + 'Q' + s[5:]
if len(s) >= 6 and s[5] == 'q':
s = s[:5] + 'Q' + s[6:]
if len(s) >= 7 and s[6] == 'q':
s = s[:6] + 'Q' + s[7:]
if len(s) >= 8 and s[7] == 'q':
s = s[:7] + 'Q' + s[8:]
if len(s) >= 9 and s[8] == 'q':
s = s[:8] + 'Q' + s[9:]
if len(s) >= 10 and s[9] == 'q':
s = s[:9] + 'Q' + s[10:]
if len(s) >= 11 and s[10] == 'q':
s = s[:10] + 'Q' + s[11:]
if len(s) >= 12 and s[11] == 'q':
s = s[:11] + 'Q' + s[12:]
if len(s) >= 13 and s[12] == 'q':
s = s[:12] + 'Q' + s[13:]
if len(s) >= 14 and s[13] == 'q':
s = s[:13] + 'Q' + s[14:]
if len(s) >= 1 and s[0] == 'r':
s = 'R' + s[1:]
if len(s) >= 2 and s[1] == 'r':
s = s[:1] + 'R' + s[2:]
if len(s) >= 3 and s[2] == 'r':
s = s[:2] + 'R' + s[3:]
if len(s) >= 4 and s[3] == 'r':
s = s[:3] + 'R' + s[4:]
if len(s) >= 5 and s[4] == 'r':
s = s[:4] + 'R' + s[5:]
if len(s) >= 6 and s[5] == 'r':
s = s[:5] + 'R' + s[6:]
if len(s) >= 7 and s[6] == 'r':
s = s[:6] + 'R' + s[7:]
if len(s) >= 8 and s[7] == 'r':
s = s[:7] + 'R' + s[8:]
if len(s) >= 9 and s[8] == 'r':
s = s[:8] + 'R' + s[9:]
if len(s) >= 10 and s[9] == 'r':
s = s[:9] + 'R' + s[10:]
if len(s) >= 11 and s[10] == 'r':
s = s[:10] + 'R' + s[11:]
if len(s) >= 12 and s[11] == 'r':
s = s[:11] + 'R' + s[12:]
if len(s) >= 13 and s[12] == 'r':
s = s[:12] + 'R' + s[13:]
if len(s) >= 14 and s[13] == 'r':
s = s[:13] + 'R' + s[14:]
if len(s) >= 1 and s[0] == 's':
s = 'S' + s[1:]
if len(s) >= 2 and s[1] == 's':
s = s[:1] + 'S' + s[2:]
if len(s) >= 3 and s[2] == 's':
s = s[:2] + 'S' + s[3:]
if len(s) >= 4 and s[3] == 's':
s = s[:3] + 'S' + s[4:]
if len(s) >= 5 and s[4] == 's':
s = s[:4] + 'S' + s[5:]
if len(s) >= 6 and s[5] == 's':
s = s[:5] + 'S' + s[6:]
if len(s) >= 7 and s[6] == 's':
s = s[:6] + 'S' + s[7:]
if len(s) >= 8 and s[7] == 's':
s = s[:7] + 'S' + s[8:]
if len(s) >= 9 and s[8] == 's':
s = s[:8] + 'S' + s[9:]
if len(s) >= 10 and s[9] == 's':
s = s[:9] + 'S' + s[10:]
if len(s) >= 11 and s[10] == 's':
s = s[:10] + 'S' + s[11:]
if len(s) >= 12 and s[11] == 's':
s = s[:11] + 'S' + s[12:]
if len(s) >= 13 and s[12] == 's':
s = s[:12] + 'S' + s[13:]
if len(s) >= 14 and s[13] == 's':
s = s[:13] + 'S' + s[14:]
if len(s) >= 1 and s[0] == 't':
s = 'T' + s[1:]
if len(s) >= 2 and s[1] == 't':
s = s[:1] + 'T' + s[2:]
if len(s) >= 3 and s[2] == 't':
s = s[:2] + 'T' + s[3:]
if len(s) >= 4 and s[3] == 't':
s = s[:3] + 'T' + s[4:]
if len(s) >= 5 and s[4] == 't':
s = s[:4] + 'T' + s[5:]
if len(s) >= 6 and s[5] == 't':
s = s[:5] + 'T' + s[6:]
if len(s) >= 7 and s[6] == 't':
s = s[:6] + 'T' + s[7:]
if len(s) >= 8 and s[7] == 't':
s = s[:7] + 'T' + s[8:]
if len(s) >= 9 and s[8] == 't':
s = s[:8] + 'T' + s[9:]
if len(s) >= 10 and s[9] == 't':
s = s[:9] + 'T' + s[10:]
if len(s) >= 11 and s[10] == 't':
s = s[:10] + 'T' + s[11:]
if len(s) >= 12 and s[11] == 't':
s = s[:11] + 'T' + s[12:]
if len(s) >= 13 and s[12] == 't':
s = s[:12] + 'T' + s[13:]
if len(s) >= 14 and s[13] == 't':
s = s[:13] + 'T' + s[14:]
if len(s) >= 1 and s[0] == 'u':
s = 'U' + s[1:]
if len(s) >= 2 and s[1] == 'u':
s = s[:1] + 'U' + s[2:]
if len(s) >= 3 and s[2] == 'u':
s = s[:2] + 'U' + s[3:]
if len(s) >= 4 and s[3] == 'u':
s = s[:3] + 'U' + s[4:]
if len(s) >= 5 and s[4] == 'u':
s = s[:4] + 'U' + s[5:]
if len(s) >= 6 and s[5] == 'u':
s = s[:5] + 'U' + s[6:]
if len(s) >= 7 and s[6] == 'u':
s = s[:6] + 'U' + s[7:]
if len(s) >= 8 and s[7] == 'u':
s = s[:7] + 'U' + s[8:]
if len(s) >= 9 and s[8] == 'u':
s = s[:8] + 'U' + s[9:]
if len(s) >= 10 and s[9] == 'u':
s = s[:9] + 'U' + s[10:]
if len(s) >= 11 and s[10] == 'u':
s = s[:10] + 'U' + s[11:]
if len(s) >= 12 and s[11] == 'u':
s = s[:11] + 'U' + s[12:]
if len(s) >= 13 and s[12] == 'u':
s = s[:12] + 'U' + s[13:]
if len(s) >= 14 and s[13] == 'u':
s = s[:13] + 'U' + s[14:]
if len(s) >= 1 and s[0] == 'v':
s = 'V' + s[1:]
if len(s) >= 2 and s[1] == 'v':
s = s[:1] + 'V' + s[2:]
if len(s) >= 3 and s[2] == 'v':
s = s[:2] + 'V' + s[3:]
if len(s) >= 4 and s[3] == 'v':
s = s[:3] + 'V' + s[4:]
if len(s) >= 5 and s[4] == 'v':
s = s[:4] + 'V' + s[5:]
if len(s) >= 6 and s[5] == 'v':
s = s[:5] + 'V' + s[6:]
if len(s) >= 7 and s[6] == 'v':
s = s[:6] + 'V' + s[7:]
if len(s) >= 8 and s[7] == 'v':
s = s[:7] + 'V' + s[8:]
if len(s) >= 9 and s[8] == 'v':
s = s[:8] + 'V' + s[9:]
if len(s) >= 10 and s[9] == 'v':
s = s[:9] + 'V' + s[10:]
if len(s) >= 11 and s[10] == 'v':
s = s[:10] + 'V' + s[11:]
if len(s) >= 12 and s[11] == 'v':
s = s[:11] + 'V' + s[12:]
if len(s) >= 13 and s[12] == 'v':
s = s[:12] + 'V' + s[13:]
if len(s) >= 14 and s[13] == 'v':
s = s[:13] + 'V' + s[14:]
if len(s) >= 1 and s[0] == 'w':
s = 'W' + s[1:]
if len(s) >= 2 and s[1] == 'w':
s = s[:1] + 'W' + s[2:]
if len(s) >= 3 and s[2] == 'w':
s = s[:2] + 'W' + s[3:]
if len(s) >= 4 and s[3] == 'w':
s = s[:3] + 'W' + s[4:]
if len(s) >= 5 and s[4] == 'w':
s = s[:4] + 'W' + s[5:]
if len(s) >= 6 and s[5] == 'w':
s = s[:5] + 'W' + s[6:]
if len(s) >= 7 and s[6] == 'w':
s = s[:6] + 'W' + s[7:]
if len(s) >= 8 and s[7] == 'w':
s = s[:7] + 'W' + s[8:]
if len(s) >= 9 and s[8] == 'w':
s = s[:8] + 'W' + s[9:]
if len(s) >= 10 and s[9] == 'w':
s = s[:9] + 'W' + s[10:]
if len(s) >= 11 and s[10] == 'w':
s = s[:10] + 'W' + s[11:]
if len(s) >= 12 and s[11] == 'w':
s = s[:11] + 'W' + s[12:]
if len(s) >= 13 and s[12] == 'w':
s = s[:12] + 'W' + s[13:]
if len(s) >= 14 and s[13] == 'w':
s = s[:13] + 'W' + s[14:]
if len(s) >= 1 and s[0] == 'x':
s = 'X' + s[1:]
if len(s) >= 2 and s[1] == 'x':
s = s[:1] + 'X' + s[2:]
if len(s) >= 3 and s[2] == 'x':
s = s[:2] + 'X' + s[3:]
if len(s) >= 4 and s[3] == 'x':
s = s[:3] + 'X' + s[4:]
if len(s) >= 5 and s[4] == 'x':
s = s[:4] + 'X' + s[5:]
if len(s) >= 6 and s[5] == 'x':
s = s[:5] + 'X' + s[6:]
if len(s) >= 7 and s[6] == 'x':
s = s[:6] + 'X' + s[7:]
if len(s) >= 8 and s[7] == 'x':
s = s[:7] + 'X' + s[8:]
if len(s) >= 9 and s[8] == 'x':
s = s[:8] + 'X' + s[9:]
if len(s) >= 10 and s[9] == 'x':
s = s[:9] + 'X' + s[10:]
if len(s) >= 11 and s[10] == 'x':
s = s[:10] + 'X' + s[11:]
if len(s) >= 12 and s[11] == 'x':
s = s[:11] + 'X' + s[12:]
if len(s) >= 13 and s[12] == 'x':
s = s[:12] + 'X' + s[13:]
if len(s) >= 14 and s[13] == 'x':
s = s[:13] + 'X' + s[14:]
if len(s) >= 1 and s[0] == 'y':
s = 'Y' + s[1:]
if len(s) >= 2 and s[1] == 'y':
s = s[:1] + 'Y' + s[2:]
if len(s) >= 3 and s[2] == 'y':
s = s[:2] + 'Y' + s[3:]
if len(s) >= 4 and s[3] == 'y':
s = s[:3] + 'Y' + s[4:]
if len(s) >= 5 and s[4] == 'y':
s = s[:4] + 'Y' + s[5:]
if len(s) >= 6 and s[5] == 'y':
s = s[:5] + 'Y' + s[6:]
if len(s) >= 7 and s[6] == 'y':
s = s[:6] + 'Y' + s[7:]
if len(s) >= 8 and s[7] == 'y':
s = s[:7] + 'Y' + s[8:]
if len(s) >= 9 and s[8] == 'y':
s = s[:8] + 'Y' + s[9:]
if len(s) >= 10 and s[9] == 'y':
s = s[:9] + 'Y' + s[10:]
if len(s) >= 11 and s[10] == 'y':
s = s[:10] + 'Y' + s[11:]
if len(s) >= 12 and s[11] == 'y':
s = s[:11] + 'Y' + s[12:]
if len(s) >= 13 and s[12] == 'y':
s = s[:12] + 'Y' + s[13:]
if len(s) >= 14 and s[13] == 'y':
s = s[:13] + 'Y' + s[14:]
if len(s) >= 1 and s[0] == 'z':
s = 'Z' + s[1:]
if len(s) >= 2 and s[1] == 'z':
s = s[:1] + 'Z' + s[2:]
if len(s) >= 3 and s[2] == 'z':
s = s[:2] + 'Z' + s[3:]
if len(s) >= 4 and s[3] == 'z':
s = s[:3] + 'Z' + s[4:]
if len(s) >= 5 and s[4] == 'z':
s = s[:4] + 'Z' + s[5:]
if len(s) >= 6 and s[5] == 'z':
s = s[:5] + 'Z' + s[6:]
if len(s) >= 7 and s[6] == 'z':
s = s[:6] + 'Z' + s[7:]
if len(s) >= 8 and s[7] == 'z':
s = s[:7] + 'Z' + s[8:]
if len(s) >= 9 and s[8] == 'z':
s = s[:8] + 'Z' + s[9:]
if len(s) >= 10 and s[9] == 'z':
s = s[:9] + 'Z' + s[10:]
if len(s) >= 11 and s[10] == 'z':
s = s[:10] + 'Z' + s[11:]
if len(s) >= 12 and s[11] == 'z':
s = s[:11] + 'Z' + s[12:]
if len(s) >= 13 and s[12] == 'z':
s = s[:12] + 'Z' + s[13:]
if len(s) >= 14 and s[13] == 'z':
s = s[:13] + 'Z' + s[14:]
return s
【问题讨论】:
-
你应该了解loops。
-
在用谷歌搜索如何在 Python 中将字符串转换为大写字母之前,一定需要相当长的时间来编写所有这些内容。
-
...阅读minimal reproducible example。强调最小
-
khelwood 不是全手写的,用宏就可以了。
-
进入编辑窗口的宏菜单。
标签: python converters letter