I have two functions, fun1 and fun2, which take as inputs a string and a number, respectively. They also both get the same variable, a, as
fun1
fun2
a
An alternative to using classes: You can use the global keyword to use variables that lie outside the function.
global
a = 5 def func(): global a return a+1 print (func())
This will print 6.
But global variables should be avoided as much as possible.