3

I'm new to python, and I just want to know a way of changing a set string variable.

For example:

name ='school'

How would I go about changing this if I wanted to use the name variable for a different value like George, Ben, Jess, Katie, etc.

belegarath
  • 41
  • 1
  • 2

1 Answers1

2

You can assign a new value to a variable in the same way you originally assigned a value to it: Using the assignment operator, =.

name = 'school'
print 'the current value of name is:', name
name = 'George'
print 'the current value of name is:', name

Result:

the current value of name is: school
the current value of name is: George
Kevin
  • 74,910
  • 12
  • 133
  • 166