#17 - Static Methods
By Ifeanyi Omeata

Hi, I am a Software Developer of 3-4 years specialising in React, Javascript, Node, NextJS, Express, Python, Django, Fast API, SQL and a few other technology stack, with a good background in Networking and Cloud Infrastructure. I am working to become a DevOps Solutions Engineer and happily married to my long time girlfriend.
Topics:
1. Static Method
1. Static Method
>>Return to Menu
class PlayerCharacter:
position = "defender"
def __init__(self,name="Sally",age=50):
self.name = name
self.age = age
@classmethod
def person(cls,call_name,call_age):
return cls(f'My name is {call_name}.', f'I am {call_age} years old.')
@staticmethod
def person2(call_name,call_age):
return f'My name is {call_name}.', f'I am {call_age} years old.'
#class method
player3 = PlayerCharacter.person('Tom',15)
print(player3)
print(player3.name)
print(player3.age)
#static method
player4 = PlayerCharacter.person2('Mary',20)
print(player4)
print(player4[0])
print(player4[1])

#End
Hope you enjoyed this! :) Follow me for more contents...
Get in Touch:
www.ifeanyiomeata.com
contact@ifeanyiomeata.com
Youtube: https://www.youtube.com/c/IfeanyiOmeata
Linkedin: https://www.linkedin.com/in/omeatai/
Twitter: https://twitter.com/iomeata
Github: https://github.com/omeatai/
Stackoverflow: https://stackoverflow.com/users/2689166/omeatai
Hashnode: https://hashnode.com/@omeatai
Medium: https://medium.com/@omeatai
© 2022






