Python小刀 -title()- lower()- upper()- 调整名字大小写
调整名字大小写:
- 将用户输入的姓名存到一个变量中,再以小写,大写和首字母大写的方式显示这个人的名字,并向用户显示一条消息。显示的消息应非常简单:Hello XXX,welcome to the world of Python!
name = input("请输入你的名字:") print(name) #字符串改为小写 print("Hello " + name.lower()+",welcome to the world of Python!") #字符串改为大写 print("Hello " + name.upper()+",,welcome to the world of Python!") #单词首字母大写 print("Hello " + name.title()+",,welcome to the world of Python!")
输出结果:
请输入你的名字:ivAN Sun ivAN Sun Hello ivan sun,welcome to the world of Python! Hello IVAN SUN,,welcome to the world of Python! Hello Ivan Sun,,welcome to the world of Python!
相关推荐
YENCSDN 2020-11-17
lsjweiyi 2020-11-17
houmenghu 2020-11-17
Erick 2020-11-17
HeyShHeyou 2020-11-17
以梦为马不负韶华 2020-10-20
lhtzbj 2020-11-17
夜斗不是神 2020-11-17
pythonjw 2020-11-17
dingwun 2020-11-16
lhxxhl 2020-11-16
坚持是一种品质 2020-11-16
染血白衣 2020-11-16
huavhuahua 2020-11-20
meylovezn 2020-11-20
逍遥友 2020-11-20
weiiron 2020-11-16