Discuss / Python / 交作业

交作业

Topic source

姬_宫_涅

#1 Created at ... [Delete] [Delete and Lock User]

L = ['Bart', 'Lisa', 'Adam'] for x in L: print('hello,%s'%x)

++++++++++++++++++++++++++++++++++++++++++++++++++++ n=5 while n>4: n=n+1 if n>4: continue print(n) #不知道这算不算死循环。。。

chengww5217

#2 Created at ... [Delete] [Delete and Lock User]

最简单的死循环应该是这个了吧 while True: pass

lorangeve

#3 Created at ... [Delete] [Delete and Lock User]

算的,但是print(n) 要放在continue前面,不然会没有输出项 n=5 while n>4: n=n+1 if n>4: print(n) continue


  • 1

Reply