Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

Chester Stephen
Chester Stephen
413 Points

Is there a cleaner and better way to write codes for this exercise i've been doing?

https://w.trhou.se/jjj9pvyorl

Above is a snapshot of my codes that ive been doing for an exercise. More details on the snapshot.

Is there any functions that I can use to make it more simple?

1 Answer

Steven Parker
Steven Parker
230,853 Points

On line 11, you can eliminate the "str" function, since what "format" returns is already a string.

Otherwise, it seems very compact already. Good job. :+1:

Chester Stephen
Chester Stephen
413 Points

Ahh! Great! Thanks Steven. Im still confused on the str,int, float thingy when converting and stuffs.