2、实内容2字符串:
a-"sir,Python"
b="Go Home"
c="hello world
d="02368hello"
1)将变量a变减全部大写字母(upper)
2)获取字符串b的张度
3)字符串a和b合并
4)a的最后6个字符和b的最后4个字符合并
5)判断变星d是否全部是字符
6)将变量c全转换成大写
7)从a/b/c三个变量中通过计算组成字符串“Python go WORLD”:
8)将变量b重复3次输出
程序源码(请将程序源码复制粘贴在下面的文本框中):
a = "sir,Python"
b = "Go Home"
c = " hello world "
d = "02368hello"
a = a.upper()
print(a)
lenb = len(b)
print(lenb)
ab = a+b
print(ab)
a6b4 = a[-6:]+b[-4:]
print(a6b4)
y = True
for i in d:
if type(i) != str:
y = False
print(y)
c = c.upper()
print(c)
combo = a[-6:]+" "+b[0:2].lower()+" "+c[-9:-4]
print(combo)
print(b*3)
a="sir,Python"
b="Go Home"
c="hello world"
d="02368hello"
a = a.upper()
print(a)
length = len(b)
print(length)
cat1 = a+b
print(cat1)
cat2 = a[-6:]+b[-4:]
print(cat2)
print(d.isalpha())
c = c.upper()
print(c)
t = ' '.join([a[-6:].title(),b[:2].lower(),c[-5:].upper()])
print(t)
print(b*3)
'''
输出结果:
SIR,PYTHON
7
SIR,PYTHONGo Home
PYTHONHome
False
HELLO WORLD
Python go WORLD
Go HomeGo HomeGo Home
'''