Flowchart (ISO 5807)
Source code
Python
def collatz_steps(n):
steps = 0
while n != 1:
if n % 2 == 0:
n //= 2
else:
n = 3 * n + 1
steps += 1
return stepsThe editor opens with this code — change it and the chart redraws.
- Language
- Python
- Constructs
- while + branching
- Topic
- Loops
- Formats
- Word, Visio, draw.io, PDF, SVG