Yau Yeehyn
Yau Yeehyn
3月前 · 4 人阅读

编程技术-week1-3">python 从入门到实践 第二章 (高级编程技术 week1-3)

现在先做一下课后的习题

2-1


a='message'
print(a)

2-2


a = 'old message'
print(a)
a = 'new message'
print(a)

2-3


a = input('What's your name : ')
print('Hello ',a,' would you like to learn some Python today')

2-4


name = input('What's your name : ')
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_persion = 'Albert Einstein'
message = famous_person + ' once said, “A person who never made a mistake never tried anything new.” '
print(message)

2-7


name = '  
	
 John 
	
  '
print(name)
print(name.lstrip())
print(name.rstrip())
print(name.strop())

2-8


print(3+5)
print(10-2)
print(2*4)
print(16/2)

2-9


my_favourite_number = 6
message = "my favourite number is " + str(my_favourite_number)
print(message)

2-10


my_favourite_number = 6
# 好像没有什么注释要加的
message = "my favourite number is " + str(my_favourite_number)
print(message)

2-11

看了一下python之禅。

\

收藏 0
关键词: print name message favourite n
评论