# Using a while loop sum_numbers = 0 num = 1 while num <= 100: sum_numbers += num num += 1 print(f"Sum of numbers 1 to 100: {sum_numbers}")
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter