0
class EPL_Team:

    def __init__(self, name, song = "No Slogan", title = 0):
        self.name = name
        self.song = song
        self.title = title

    def increaseTitle(self, title = 0):
        self.title = title
        self.title +=1

    def changeSong(self, song):
        self.song = song

    def showClubInfo(self):
        print("Name:", self.name, "|", "Song:", self.song, "\nTotal No of Title: ", self.title)
    
manu = EPL_Team('Manchester United','Glory Glory Man United')
chelsea = EPL_Team('Chelsea')
print('=====')
print(manu.showClubInfo())
manu.increaseTitle()
print(manu.showClubInfo())
print('=====')
print(chelsea.showClubInfo())
chelsea.changeSong('Keep the blue flag flying high')
print(chelsea.showClubInfo())
print('=====')

my output:

=====
Name: Manchester United | Song: Glory Glory Man United 
Total No of Title:  0
None
Name: Manchester United | Song: Glory Glory Man United 
Total No of Title:  1
None
=====
Name: Chelsea | Song: No Slogan 
Total No of Title:  0
None
Name: Chelsea | Song: Keep the blue flag flying high 
Total No of Title:  0
None
=====

The output should be:

=====
Name: Manchester United | Song: Glory Glory Man United
Total No of title: 0
Name: Manchester United | Song: Glory Glory Man United
Total No of title: 1
=====
Name: Chelsea | Song: No Slogan
Total No of title: 0
Name: Chelsea | Song: Keep the blue flag flying high
Total No of title: 0
=====
runDOSrun
  • 10,359
  • 7
  • 47
  • 57

1 Answers1

0

In the showClubInfo() function you print the club information so you don't need to type print(manu.showClubInfo()) because that prints the return value of the function and you don't return anything so it prints None. If you want to use print(manu.showClubInfo()) you should change the code of the showClubInfo() function to:

def showClubInfo(self):
    return "<insert information here>"
Andrej
  • 2,743
  • 2
  • 11
  • 28