python课程作业——第2章 变量和简单数据类型

时间:2022-06-18 01:35:17

第2章 变量和简单数据类型

python课程作业——第2章 变量和简单数据类型

# 2-3
name = "Eric"
print("Hello " + name + ", would you like to learn some Python today?")
# 2-4
name = "Albert Einstein"
print(name.upper())
print(name.lower())
print(name.title())
# 2-5
print('Albert Einstein once said, "A person who never made a mistake never tried anything new."')
# 2-6
famous_person = "Albert Einstein"
message = 'A person who never made a mistake never tried anything new.'
print(famous_person + ' once said, "' + message + '"')
# 2-7
name = "\tAlbert Einstein\n"
print("origin: ")
print(name)
print("lstrip: ")
print(name.lstrip())
print("rstrip: ")
print(name.rstrip())
print("strip: ")
print(name.strip())