That’s because this: 'c'=='s' and 'd'=='t'
is always False, like a said above. If you change it to c=='s' and d=='t'
and enter s and t when prompted for username/password, the use() function will be called.
Sure it does. I tested it and it works as expected:
————————————————————————————
1) login
2) signin
————————————————————————————
enter here: 1
enter name: s
enter password : t
hello
————————————————————————————
1) mail
2) logout
————————————————————————————
enter here: 1
no mail received
hello
————————————————————————————
1) mail
2) logout
————————————————————————————
enter here:
If you expect something else, you will have to specify what it is you want to do.
Functions can’t see variables defined in other functions. To make the s and t variables accessible from within log, you will need to do one of the following:
Pass them in as arguments to log
Store them in global variables
Create a class and make s and t instance attributes
Additionally, you must ensure that sig is called before log, since the latter requires data from the former.