程序的基础知识

# s2 = s.lower() # 小写 所有的单词字母小写
# print(s2)
#s = "al1ex is a gay and Wu傻sir is A gay too"
# s1 = s.capitalize() # 把首字母变成大写
# print(s1)
# s3 = s.upper()  # 大写   所有单词字母大写
# print(s3)

# s4 = s.swapcase() # 大小写互换 所有单词中的字母互换
# print(s4)
返回比较大的那个数字
 a if a > b else b
例题:
a = 1
def fun_1():
a = 2
def fun_2():
global a
a = 3
def fun_3():
a = 4
print(a,'四')
print(a,'三')
fun_3()
print(a,'五')
print(a,'二')
fun_2()
print(a,'六')
print(a,'一')#1
fun_1()#2
print(a,'七')?最后一个为什么是3,打印结果

猜你喜欢

转载自www.cnblogs.com/li-123-peng/p/9688462.html