Informatics Practices
Write the output of the following:
for i in '123' :
print ("Message",i,)
Python Control Flow
3 Likes
Answer
Message 1
Message 2
Message 3
Working
The code uses a for
loop to iterate over each character in the string '123'. During each iteration, it prints the string "Message" followed by the current character i
.
Answered By
1 Like
Related Questions
Find the output of the following program segment:
country = 'INDIA' for i in country: print (i)
Find the output of the following program segment:
i = 0; sum = 0 while i < 9: if i % 4 == 0: sum = sum + i i = i + 2 print (sum)
Write the output of the following:
for i in [100,200,300] : print (i)
Write the output of the following:
for j in range (10,6,-2) : print (j*2)