标签:print break 定义 else lap div highlight class for
answer = 10 for i in range(3): guess = int(input(‘猜一个‘)) if guess == answer: print(‘ok‘) break elif guess > answer: print(‘猜大了‘) else: print(‘猜小了‘) else: print(‘机会用完了‘) for i in range(10): print(‘loop‘,i) print(‘---------‘) for i in range(0,10,2): #最后一个2是步进值 print(‘loop‘,i) print(‘---------‘) for i in range(1,11): #或者可以定义从1开始到11,也是10个循环 print(‘loop‘,i) print(‘---------‘)
标签:print break 定义 else lap div highlight class for
原文地址:http://www.cnblogs.com/jackadam/p/7842705.html