The reason you get this error is that z1 doesn't exist inside the function at the time of the input command.
The only way I can think of to do this is to enter
after the input prompt.
for details of this function.
Your problem is a bit odd to me, though. If you already know what z1 is before you call the function, why are you asking the user for it? Why not just pass it as an argument?
Best Answer