Python Forum
name 'fullname' is not defined
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
name 'fullname' is not defined
#3
(Aug-27-2018, 02:45 PM)buran Wrote: fullname is method of class Person, so you need to call it like this
person1.fullname()
you may want to print when call it
print(person1.fullname())
a bit advanced, would be to make it a property (not method). If it is too advanced, just ignore this for the moment
@property
def fullname(self):
    return '{} {} {}'.format(self.first, self.last, self.fathers_name)
if you do so, you will access it like this
person1.fullname

Thanks you helped me a lot ! I appericate it !
Reply


Messages In This Thread
name 'fullname' is not defined - by witch - Aug-27-2018, 02:29 PM
RE: name 'fullname' is not defined - by buran - Aug-27-2018, 02:45 PM
RE: name 'fullname' is not defined - by witch - Aug-27-2018, 02:57 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  python library not defined in user defined function johnEmScott 2 5,030 May-30-2020, 04:14 AM
Last Post: DT2000

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020