- 1

How to print the individual digits of given number

23rd Jun 2021, 8:23 AM
Usha sri Vanama
Usha sri Vanama - avatar
3 Respostas
- 1
```py val_list = list(str(100)) val_list[0] #1 val_lis[1] #0 #... ```
23rd Jun 2021, 8:25 AM
Ananiya Jemberu
Ananiya Jemberu - avatar
+ 2
convert it to string, then convert that string to list or iterate over chars of string and print each chars (digits)
23rd Jun 2021, 8:26 AM
visph
visph - avatar
+ 1
x=4567 #convert to string: y = str(x) #print out every digit of number: for i in y: #as integer: print(int(i)) #or as type str: print(i)
23rd Jun 2021, 8:31 AM
Shadoff
Shadoff - avatar