0

I want to put the for Loops and the sum together is that possible in python ?

12th Oct 2020, 1:05 AM
Malek Blr
2 Respostas
+ 2
Yes, it is possible as Diego demostrates, but we don't know exactly what do you want to do. If you already have a working code you can share it here so we can guide you further.
12th Oct 2020, 1:14 AM
Kevin ★
+ 1
How to write for loop in one line ? x="123" sum=0 for i in x: sum=sum+int(i) print("sum of digits is",sum) I want to write this for loop in one line how can I do that ? https://code.sololearn.com/cLXij8Zqajo7/?ref=app
12th Oct 2020, 1:12 AM
Diego Lesmes
Diego Lesmes - avatar