Python Forum
Collatz in Python...pls help
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Collatz in Python...pls help
#4
Your output is the same as Larz60+'s one, you just run the infinite while loop a little bit longer.

Also, the logic of your first program is incorrect. When c is equal to 1, the elif c % 2 == 1: is true and therefore the statement elif c == 1: is never executed.
Reply


Messages In This Thread
Collatz in Python...pls help - by mepyyeti - Dec-31-2017, 04:43 AM
RE: Collatz in Python...pls help - by Larz60+ - Dec-31-2017, 06:26 AM
RE: Collatz in Python...pls help - by mepyyeti - Dec-31-2017, 07:26 AM
RE: Collatz in Python...pls help - by squenson - Dec-31-2017, 07:52 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How can I found how many numbers are there in a Collatz Sequence that I found? cananb 2 2,654 Nov-23-2020, 05:15 PM
Last Post: cananb
  Collatz Conjecture Formatting TreasureDragon 2 2,474 Feb-11-2019, 10:39 PM
Last Post: TreasureDragon

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020