i was trying to solve problem 5 using a gcd and lcm function and a for loop to iterate the lcm (yes, i'm a beginner). However, the loop does not seem to work and the output is always equal to 1. What do I do wrong? I'm using the python 3.4.1 shell

your loop is only managing to loop once before it returns, can you see why it returns without carrying on the rest of the loop before it returns the result.

Due to the reasons discussed here we will be moving to python-forum.io/ on October 1 2016This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.

Yoriz wrote:your loop is only managing to loop once before it returns, can you see why it returns without carrying on the rest of the loop before it returns the result.

The hints where there as the indentaion of your return was incorrect making it return on the first iteration of the loop.Its better that you worked out how to solve it on your own though, well done.

Due to the reasons discussed here we will be moving to python-forum.io/ on October 1 2016This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.