I have an attribute named session that is set to 1. In changeSession() I am trying to change its value to 2. In the last step session is printed and it is still 1. You can see the the code below. Doing the following would make us print the value 2:
- session=changeSession()
let changeSession() return the new session value.
However, is it possible to get the value 2 printed without letting changeSession() return anything?
The code:
session=1
def set_session(s):
session=s
def changeSession():
set_session(2)
changeSession()
print session