Rewrite the following code fragments using for loop:
(a) while num > 0 :
print(num % 10)
num = num/10
(b) i = 100
while (1 > 0):
print(i)
i=3
Answers
Answered by
1
Explanation:
(a)
for i in range(len(str(num))):
print(num%10)
num = num//10
if num==0:
break
(b) this code is not complete. send me the correct code. I will give you the answer.
Similar questions
Business Studies,
4 months ago
English,
4 months ago
English,
4 months ago
Psychology,
8 months ago
English,
11 months ago
Sociology,
11 months ago
English,
11 months ago