num=["a","b","c","d"] num[0]=int(input("enter an int for a: ")) num[1]=int(input("enter an int for b: ")) num[2]=int(input("enter an int for c: ")) num[3]=int(input("enter an int for d: ")) def finding_max(): for i in num: max > i print({i}) finding_max()
if
Quote:Can I use if in for loop in Python
for i in num: if i > max: max = i print (max)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)