Can someone review this code? I am writing code to make classes in a to do list. /u/Fresh_Heron_3707 Python Education

class Urgent: def init(self): self.task1 = “Feed Prince” self.task2 = “Bond with Prince” self.task3 = “Clean Prince’s litterbox”

usage is how many times a function is called for

def print_tasks(self): print("Urgent tasks:") print("- " + self.task1) print("- " + self.task2) print("- " + self.task3) 

lines 3-5 are instance variable not regular varaibles

class Moderate: def init(self): self.task1 = “Play with Prince” self.task2 = “Pet Prince” self.task3 = “Clean Prince’s bed”

def print_tasks(self): print("Moderate tasks:") #the blank Quotations are defined above and that will populate the empty space! print("- " + self.task1) print("- " + self.task2) print("- " + self.task3) 

class Basic: def init(self): self.task1 = “Set out Prince’s toys” self.task2 = “Clean off Prince’s bed” self.task3 = “Give Prince a hug before work” self.task4 = “Tell Prince he is loved”

def print_tasks(self): print("Basic tasks:") print("- " + self.task1) print("- " + self.task2) print("- " + self.task3) print("- " + self.task4) 

class Wishlist: def init(self): self.task1 = “Get holy water for Prince” self.task2 = “Have Prince blessed” self.task3 = “Get Prince a cat friend” self.task4 = “Get Prince some new toys”

def print_tasks(self): print("Wishlist tasks:") print("- " + self.task1) print("- " + self.task2) print("- " + self.task3) print("- " + self.task4) 

main gets all the tasks working and executable

having main defined at the helps keep the code readable and understandable

def main(): u = Urgent() u.print_tasks()

U is a regular variable here so it is the U variable

.print_tasks is the defined in the self statement

m = Moderate() m.print_tasks() b = Basic() b.print_tasks() w = Wishlist() w.print_tasks() 

main()

I promise this isn’t ai generated.

submitted by /u/Fresh_Heron_3707
[link] [comments]

​r/learnpython class Urgent: def init(self): self.task1 = “Feed Prince” self.task2 = “Bond with Prince” self.task3 = “Clean Prince’s litterbox” usage is how many times a function is called for def print_tasks(self): print(“Urgent tasks:”) print(“- ” + self.task1) print(“- ” + self.task2) print(“- ” + self.task3) lines 3-5 are instance variable not regular varaibles class Moderate: def init(self): self.task1 = “Play with Prince” self.task2 = “Pet Prince” self.task3 = “Clean Prince’s bed” def print_tasks(self): print(“Moderate tasks:”) #the blank Quotations are defined above and that will populate the empty space! print(“- ” + self.task1) print(“- ” + self.task2) print(“- ” + self.task3) class Basic: def init(self): self.task1 = “Set out Prince’s toys” self.task2 = “Clean off Prince’s bed” self.task3 = “Give Prince a hug before work” self.task4 = “Tell Prince he is loved” def print_tasks(self): print(“Basic tasks:”) print(“- ” + self.task1) print(“- ” + self.task2) print(“- ” + self.task3) print(“- ” + self.task4) class Wishlist: def init(self): self.task1 = “Get holy water for Prince” self.task2 = “Have Prince blessed” self.task3 = “Get Prince a cat friend” self.task4 = “Get Prince some new toys” def print_tasks(self): print(“Wishlist tasks:”) print(“- ” + self.task1) print(“- ” + self.task2) print(“- ” + self.task3) print(“- ” + self.task4) main gets all the tasks working and executable having main defined at the helps keep the code readable and understandable def main(): u = Urgent() u.print_tasks() U is a regular variable here so it is the U variable .print_tasks is the defined in the self statement m = Moderate() m.print_tasks() b = Basic() b.print_tasks() w = Wishlist() w.print_tasks() main() I promise this isn’t ai generated. submitted by /u/Fresh_Heron_3707 [link] [comments] 

class Urgent: def init(self): self.task1 = “Feed Prince” self.task2 = “Bond with Prince” self.task3 = “Clean Prince’s litterbox”

usage is how many times a function is called for

def print_tasks(self): print("Urgent tasks:") print("- " + self.task1) print("- " + self.task2) print("- " + self.task3) 

lines 3-5 are instance variable not regular varaibles

class Moderate: def init(self): self.task1 = “Play with Prince” self.task2 = “Pet Prince” self.task3 = “Clean Prince’s bed”

def print_tasks(self): print("Moderate tasks:") #the blank Quotations are defined above and that will populate the empty space! print("- " + self.task1) print("- " + self.task2) print("- " + self.task3) 

class Basic: def init(self): self.task1 = “Set out Prince’s toys” self.task2 = “Clean off Prince’s bed” self.task3 = “Give Prince a hug before work” self.task4 = “Tell Prince he is loved”

def print_tasks(self): print("Basic tasks:") print("- " + self.task1) print("- " + self.task2) print("- " + self.task3) print("- " + self.task4) 

class Wishlist: def init(self): self.task1 = “Get holy water for Prince” self.task2 = “Have Prince blessed” self.task3 = “Get Prince a cat friend” self.task4 = “Get Prince some new toys”

def print_tasks(self): print("Wishlist tasks:") print("- " + self.task1) print("- " + self.task2) print("- " + self.task3) print("- " + self.task4) 

main gets all the tasks working and executable

having main defined at the helps keep the code readable and understandable

def main(): u = Urgent() u.print_tasks()

U is a regular variable here so it is the U variable

.print_tasks is the defined in the self statement

m = Moderate() m.print_tasks() b = Basic() b.print_tasks() w = Wishlist() w.print_tasks() 

main()

I promise this isn’t ai generated.

submitted by /u/Fresh_Heron_3707
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *