Define a class named American which has a static method called printNationality.


Topic: Define a class named American which has a static method called printNationality.

Solution

class American(object):
@staticmethod
def printNationality():
print ("America")
anAmerican = American()
anAmerican.printNationality()
American.printNationality()



List all Python Programs