Names

Report a typo

Look at the definition of the class below. Which of the methods can be static?

class Person:

    def __init__(self, name):
        self.name = name

    def greet(self):
        return 'Hello, my name is {}'.format(self.name)

    def make_uppercase(self):
        name_uppercase = self.name.title()
        return '{} has been converted to {}'.format(self.name, name_uppercase)

    def check_string(self, string):
        if len(string) > 1:
            return string
        else:
            return 'Try entering other name!'
Select one option from the list
___

Create a free account to access the full topic