两种循环: 1 for in 2 while #coding:utf-8 #/usr/bin/python """ 2018-11-03 dinghanhua 循环语句 """ '''for in''' #打印0-9 for i in range(10): print(i) #取出元组中不能被2整除的数据 turple = (1,13,33,54,8329) for i in turple: if(i%2 == 1): print(i) '''w…
Python中有while循环和for循环 下面以一个小例子来说明一下用法,用户输入一些数字,输出这些数字中的最大值和最小值 array = [5,4,3,1] for i in array: print(i) largest = None smallest = None while True: num = input("Enter a number: ") if num == "done" : break if len(num) < 1 : break #…