2-3个性化信息:将用户的姓名存贮到一个变量中,并向该用户显示一条信息
first_name="ada"
last_name="lovelace"
full_name=first_name+" "+last_name
print(full_name)
example="hello,would you like to learn some python today"
fin=full_name+":"+example
print(fin)
2-4调整名字的大小写:
将一个人名存储到一个变量中,再以小写、大写和首字母大写的方式显示这个人名
name="ada"
print(name)
print(name.lower())#小写
print(name.upper())#大写
print(name.title())#首字母大写
结果
D:\pythonProject6\p\Scripts\python.exe D:/pythonProject6/main.py
ada
ada
ADA
Ada
2-5名言(引号的应用)找一句名人姓名和他的名言打印出来。
message='Albert Einstein once side,"A person who never made a mistake never tried anyting new.'
print(message)
结果
D:\pythonProject6\p\Scripts\python.exe D:/pythonProject6/main.py
Albert Einstein once side,"A person who never made a mistake never tried anyting new.