I'm a beginner with python so tell me if I'm missing out on something. I have a python file named abc.py that looks like this:
class Person:
def __init__ (self, age, weight, height, first_name, last_name, gpa ):
self.age = age
self.weight = weight
self.height = height
self.first_name = first_name
self.last_name = last_name
self.gpa = gpa
def on_honor_roll(self):
if self.gpa >= 3.5:
return True
else:
return False
And another python file named objetc_functions.py that looks like this: from abc import Person
user1 = Person(25, 80, 178, "John", "Williams", "To be or not to be")
user2 = Person(15, 78, 190, "Joe", "James", "Good morning" )
print(user1.on_honor_roll())
And when I run objectfunctions I get an InportError message that says:
ImportError: cannot import name "Person" from "abc"
CodePudding user response:
abc
is a Python core module. You should avoid naming your modules like core modules.