x="1,2,3"
for i in x:
print(i)
Answers
Answered by
0
Correction:
x="1,2,3"
for i in x:
print(i)
Output:
1
,
2
,
3
Explanation:
The datatype of x is string since you've covered the whole value between quotes.
The program treats 1,2,3 as a combination of letters and not numbers and iterates it as a string.
Consider this for example:
a="apples"
for i in a:
print i
Here the values being printed would be:
a
p
p
l
e
s
The reason being this whole thing is a string.
Similar questions
Social Sciences,
1 month ago
Math,
1 month ago
Environmental Sciences,
4 months ago
Physics,
4 months ago
Physics,
10 months ago
History,
10 months ago
Science,
10 months ago