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
dmitriy ignatiev
Python Web Development Techdegree Student 1,789 Pointswhile loop
Hi everyone
I just want to code some simple calculator using while but my loop do only one time after it it caused error. And i do not know why. I exactly want to use function inside the loop. Please tell me where i am going wrong. Thanks
here is my code:
def ldm(length, width):
return (length / width) / 2.4
while True:
length = int(input("indicate length:"))
width = int(input("indicate width:"))
ldm = ldm(length, width)
print(ldm)
1 Answer
Idan Melamed
16,285 PointsHi Dmitriy,
Try replacing:
ldm = ldm(length, width)
print(ldm)
with this:
print(ldm(length, width))