- 1

How to compare this

var1 = ["19", "5", "17",] var2 = (18) var3 = (9) def compare(n): if var1[n] >= var2: print(str(var1[n]) + " greater than " + str(var2) + " =100%") print("\n") elif var1[n] >= var3: print(str(var1[n]) + " greater than " + str(var3) + " =50%") print("\n") else: print(str(var1[n]) + " less than " + str(var3) + " =0%") print("\n") for a in range (len(var1)): compare(a)

24th Sep 2016, 12:45 PM
mynameis
2 ответов
+ 2
def compare(var1): var2 = 18 var3 = 9 if var1 >= var2: print(str(var1) + " greater than " + str(var2) + " = 100%\n") elif var1 >= var3: print(str(var1) + " greater than " + str(var3) + " = 50%\n") else: print(str(var1) + " less than " + str(var3) + " = 0%\n") var1 = [19, 5, 17] for a in var1: compare(a)
24th Sep 2016, 1:58 PM
Zen
Zen - avatar
0
Yes, its work now.. Tq
25th Sep 2016, 3:20 AM
mynameis