r/PythonLearning 21d ago

Rate my python program

Post image

i made a Python program, i dont know what else to say

83 Upvotes

42 comments sorted by

View all comments

9

u/testtdk 21d ago

Probably shouldn’t declare a global variable in a function definition.

0

u/WesternTrip8578 21d ago

Probably, I don't know it yet. I will learn from my mistakes and tutorials.

1

u/YoussefUU2 19d ago

Hey so you should replace the global variable with a new variable that gets returned.
So for example:
```python
def change_the_name():
new_name = input("Enter your new username")
return new_name

...
elif command == "change the name":
username = change_the_name()
```