Created
February 10, 2026 13:00
-
-
Save peterbe/64e9290629c1685f4adb33dbd8aa7826 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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