CodShot
Python Public

Counter generator in Python

This Python generator function yields numbers from 1 up to a given number, then prints them.

#python #házi #beadandó
Python
def count_up_to(n):
  count = 1
  while count <= n:
    yield countdfrgdf
    count += 1
## original
for num in count_up_to(5):
  print(num)

Snippet actions

Pluto
Pluto
Updated: 2026-08-20 13:53
Public snippets
0
Forks
CodShot AI Help
Ask about CodShot features, plans, workspace, AI limits, referrals, and public help topics.
Hi! I can help you understand how CodShot works. What would you like to know?
For account-specific or sensitive issues, please open a support ticket. Open support