我是靠谱客的博主 无心纸鹤,最近开发中收集的这篇文章主要介绍SYSU python 第二周作业,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述


 
3.1-3.3
names=['Lzy','Lyj','Lzc']
for name in names:
   print(name)
  
for name in names:
   print(name+", good morning!")
v=["Honda motorcycle","BMW car","Kawasaki motorcycle","Toyota car"]
for i in v:
   print("I'd like to own a "+i)
3.4-3.7
names=['aaa','bbb','ccc']
print (names)
for name in names:
   print(name+"'s invitation")
print ("aaa is not able to come")
names[0]='ddd'
print (names)
for name in names:
   print(name+"'s invitation")
print ("I've found a bigger desk")
names.insert(0,'eee')
names.insert(2,'fff')
names.append('ggg')
print (names)
for name in names:
   print(name+"'s invitation")
while len(names)>2:
   poped=names.pop()
   print(poped+ "--sorry")
for name in names:
   print(name+ " is still in list")
del names[0]
del names[0]
print(names) 

4.1-4.2
pizza=['a','b','c']
for kinds in pizza:
    print("I like",kinds,"pizza")
print("I really like pizza")
pet=['cat','dog']
for pets in pet:
    print("A",pets,"would make a great pet")
print("Any of these animals would make a great pet")
4.3-4.9
for num in range(1,21):
    print (num,end=" ")
print()

numlist=list(range(1,1000001))
for num in numlist:
    print (num,end=" ")
print()
print (min(numlist))
print (max(numlist))
print (sum(numlist))

numlist2=list(range(1,20,2))
for num in numlist2:
    print (num,end=" ")
print()

numlist3=list(range(3,31,3))
for num in numlist3:
    print (num,end=" ")
print()

numlist4=(value**3 for value in range(1,11))
for num in numlist4:
    print (num,end=" ")
print()
4.10
pizza=['a','b','c','d','e']
print(pizza[:3])
print(pizza[1:4])
print(pizza[-3:])


最后

以上就是无心纸鹤为你收集整理的SYSU python 第二周作业的全部内容,希望文章能够帮你解决SYSU python 第二周作业所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(46)

评论列表共有 0 条评论

立即
投稿
返回
顶部