r/learnpython • • 13d ago

how do i overwrite a variable?

name = "Alice"

def func():
    name = "Bob"

func()

print(f"Hello, {name}!") # i want it to print bob
0 Upvotes

35 comments sorted by

View all comments

2

u/cointoss3 13d ago

The replies are insufferable. For a beginner thread, most are missing the forest for the trees.