0

I am starting to learn python as my first programming language, but i ran into a problem while trying to make a function that calculated the missing variable in the simple equation v= u+at.

The problem is that i am incapable to change a variable's value from False to True during a for loop. I tried using the vars()[] function to convert string to an usable variable, but the change in the variable doesn't seem to register.

I appreciate any solutions to this problem or any type of help on any incorrect or inefficient use of code in my function.

(The commented part doesn't seem cause problems, but i posted it regardless in case there is something i overlooked.)

```
def F1(v,u,a,t):
'''Enter 3 values using None for the missing one to calc using v=u+at'''
vTrue=False
uTrue=False
aTrue=False
tTrue=False
numVars=0
for i in ('v','u','a','t'):
if type(vars()[i])== type(1) or type(vars()[i])==type(0.1):
print('val correct')
vars()[i+'True']=True
numVars+=1
## elif type(vars()[i])!= type(None):
## print('Error, Wrong input type entered')
## return 'Error'
## print(vars()[i+'true'])
## if numVars<3:
## return None
## elif numVars==4:
## return(v,u,a,t)
## if vtrue==False:
## v=u+(a*t)
## return(v,u,a,t)
## if utrue==False:
## u=v-(a*t)
## return(v,u,a,t)
## if atrue==False:
## a=(v-u)/t
## return(v,u,a,t)
## if ttrue==False:
## t=(v-u)/a
## return(v,u,a,t)
## else:
## print('No answer found')
## return('Error')
```