What's new

Welcome to ComSci.

Welcome to our Computer Science Forum! Dive into discussions, resources, and collaborations with fellow enthusiasts. Let's explore the endless possibilities of technology together!

Ask question

Ask questions and get answers from our community

Answer

Answer questions and become an expert on your topic

Contact us

Contact the site administrator directly.

OOP LAB #1

Chrollo

Administrator
Staff member
Joined
May 11, 2024
Messages
16
Reaction score
0
Points
6
Python:
class Myclass():
    
    def Juls(self): #needs parameter if u will not use @staticmethod / for instance variables, it allows u to access attributes
        print("\"YourName\"")
    
    def Juls2(self, SomeString):
        print("\"YourBlock\"", SomeString)

    @staticmethod  #u can use the @staticmethod if don't want to place parameter 
    def Juls3():
        integer = 2024
        year = str(integer)
        CurrentDate = ("August 25, " + year)
        print(CurrentDate.upper())

if __name__=="__main__":
    c = Myclass()
    c.Juls()
    c.Juls2("\n\"TeachersName\"")
    print("\"yourBirthDay\"\n\"Municipality\", \"province\"")
    c.Juls3()
    print("done\n\n")

Try it Yourself
 
shape1
shape2
shape3
shape4
shape5
shape6
Top