Search the courses, subjects, tracks, games and features, or jump straight to a page.
4 cards from this section. Quick, good the night before a test.
What does the @staticmethod decorator do?
Think about the relationship with the instance.
Can you call a static method without creating an instance of the class?
Recall the syntax of calling class methods.
What is the primary feature of a static method?
Think about the definition of static methods.
True or False: A static method can directly modify instance variables.
Recall what makes a method 'static'.
Create a class 'Converter' with a static method that converts Celsius to Fahrenheit.
Remember to use the conversion formula correctly.
Define a static method that validates a phone number format, returning True if valid, otherwise False. Use regular expressions to check the format.
Think about how you can use regex to validate format.
5 more questions in this section. Enroll free to practise them all.
Enroll free