I am new to programming and I am trying to teach myself. I am starting with python and I am struggling to figure out if I am going about this the right way. I am trying to figure out how to access a specific variable from inside a function outside of that function.
weight = input('Enter Amount: ')
def quantity():
p_total = weight / 454
print(f'Amount: {p_total}')
hp_total = weight / 227
print(f'Amount HP: {hp_total}')
qp_total = weight / 114
print(f'Amount QP: {qp_total}')
return p_total, hp_total, qp_total
print(qp_total)
I want to then be able to access the individual variables created in there as needed. Such as being able to call just qp_total or p_total. Or would this not be a good use of a function? Again I am still extremely new to coding.