Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
class arguements
#4
yea i'm reading it now (i read the first article, now i'm in the class inheritance article),
and there's something that i see repeats itself always when defining a class:

in this code:
class AnyEmployee(object):
    
   def __init__(self, grade, title, first, last, location, phone, pay):
      self.grade = grade
      self.title = title
      self.name = (last, first)
      self.location = location
      self.phone = phone
      self.pay = pay
       
   def contact_info(self):
      text = ', '.join(self.name) + ' ('
      if self.location:
         text += self.location + ', '
      text += self.phone + ')'
      return text
    
   def weekly_pay(self, hours = 0):
      if self.grade == 'Manager':
         return round(self.pay / 52, 2)
      else:
         week = self.pay * hours
         if hours > 40:
            week += self.pay * 0.5 * (hours - 40)
         return week
how do you call lines 4 to 9 ? (like, is there a term for it ?)
Reply


Messages In This Thread
class arguements - by astral_travel - Apr-29-2020, 10:03 AM
RE: class arguements - by pyzyx3qwerty - Apr-29-2020, 10:19 AM
RE: class arguements - by buran - Apr-29-2020, 10:36 AM
RE: class arguements - by astral_travel - Apr-29-2020, 03:44 PM
RE: class arguements - by deanhystad - Apr-29-2020, 04:04 PM
RE: class arguements - by buran - Apr-29-2020, 04:14 PM
RE: class arguements - by astral_travel - Apr-29-2020, 04:16 PM
RE: class arguements - by buran - Apr-29-2020, 04:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Accessing varying command line arguements Rakshan 3 2,084 Jul-28-2021, 03:18 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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