Python Local Variable Referenced Before Assignment
I am trying to figure out what I continue to do wrong here with my code. I have tried changing the second portion by eliminating everything after # The main function. Thoughts? I g
Solution 1:
In main:
print('This will be added to the records. ')
print('Here is the data you entered:')
print('Pet Name: ', pets.get_pet_name)
print('Animal Type: ', pets.get_pet_type)
print('Age: ', pets.get_pet_age)
pets = Pet(name, animal_type, age)
you print the pets values before actually initializing / declaring it. I think you want:
pets = Pet(name, animal_type, age)
print('This will be added to the records. ')
print('Here is the data you entered:')
print('Pet Name: ', pets.get_pet_name)
print('Animal Type: ', pets.get_pet_type)
print('Age: ', pets.get_pet_age)
Post a Comment for "Python Local Variable Referenced Before Assignment"