Computer Science, asked by rkrkrks9564, 7 months ago

write Python output of I in (20,42,50,80) Print one

Answers

Answered by mad210203
0

Output:

20

42

50

80

Explanation:

  • for loop is a type of loop available in python.
  • A for loop is mainly used to iterate a sequence.
  • It is used to iterate over a list, tuple and strings.
  • Iterating over a sequence is also called as traversal.
  • Syntax: for variable in sequence:

Program:

#This is a for loop. It starts with 1 and ends at 80. If i = 20, 42, 50 and 80, then only it goes inside the loop.

#When it goes inside the loop, it prints the value of i.

for i in (20,42,50,80):

print(i)

Refer the attached image for the output.

Attachments:
Similar questions