๐Ÿ“– Beginning Python Programming /
Module: Controlling logic flow

for...in...:

๐Ÿ“– Beginning Python Programming / Controlling logic flow / for...in...:

range(start, end, step)

print("0-9")
for i in range(10):
    print(i)
print("1-10")
for i in range(1,11):
    print(i)
print("1,3,5,7,9")
for i in range(1,10,2):
    print(i)
print("2,4,6,8,10")
for i in range(2,11,2):
    print(i)
list = ["Apple", "Banana", "Cherry"]
for item in list:
    print(item)
def is_student_pass(score):
    if score >= 60:
        return "Pass"
    else:
        return "Fail"

list = [80, 59, 62, 70, 99, 40, 51]
for score in list:
    print("{}: {}".format(score, is_student_pass(score)) )
list = [80, 59, 62, 70, 99, 40, 51]
for score in list:
    result = is_student_pass(score)
    print("{}: {}".format(score, result) )