Computer Science
Write the output of the following:
for i in '123':
print("guru99",i,)
Python
Python Control Flow
1 Like
Answer
guru99 1
guru99 2
guru99 3
Working
The for loop iterates over each character in the string '123'. For each character, it prints "guru99" followed by the character. The comma after i in the print() function ensures a space between "guru99" and each character.
Answered By
2 Likes
Related Questions
Construct a logical expression to represent each of the following conditions:
(a) Mark is greater than or equal to 100 but less than 70.
(b) Num is between 0 and 5 but not equal to 2.
(c) Answer is either 'N' OR 'n'.
(d) Age is greater than or equal to 18 and gender is male.
(e) City is either 'Kolkata' or 'Mumbai'.
Find error in the following code (if any) and correct it by rewriting the code and underline the corrections:
code=input ("Enter season code : ") if code=w: print "winter season" elif code==r: PRINT "rainy season" else: Print "summer season"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)