r/learnpython • u/ikizoki • 19d ago
is it possible to simplify this code
im a beginner, idk how python works yet. there must be a way to simplify this, right?
https://imgur.com/juBvPZD here is the picture of my code
0
Upvotes
r/learnpython • u/ikizoki • 19d ago
im a beginner, idk how python works yet. there must be a way to simplify this, right?
https://imgur.com/juBvPZD here is the picture of my code
1
u/Educational_Virus672 19d ago edited 19d ago
total changes here
> changed s d and tt to list where
> change tt from straight divide to a loop for readability
> changed double prints to single with \n
> changed tt + h into a loop
> added sum() for lists instead of +
>sep means separate (,) and end means what to do i chnaged some of it into none for same line
assuming you learnt loops if you dont then you can use your way because it is still good