Skip to content

Instantly share code, notes, and snippets.

@peterbe
Created February 10, 2026 13:00
Show Gist options
  • Select an option

  • Save peterbe/64e9290629c1685f4adb33dbd8aa7826 to your computer and use it in GitHub Desktop.

Select an option

Save peterbe/64e9290629c1685f4adb33dbd8aa7826 to your computer and use it in GitHub Desktop.
names = []
def print_them():
for name in names:
print("name:", name)
def add_them():
names.append("Peter")
names.append("Hasan")
def main():
add_them()
print_them()
if __name__ == "__main__":
main()
def print_them(names):
for name in names:
print("name:", name)
def add_them():
names = []
names.append("Peter")
names.append("Hasan")
return names
def main():
names = add_them()
print_them(names)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment