๐Ÿ”’ Closed Python?

Status
Not open for further replies.
Python:
class Google:
    def __init__(self, query):
        self.query = query
    
    def search(self):
        print("Searching for query", self.query)
 
google = Google(query="How to write basic class and objects in python")
google.search()
 
Python:
class Lodi:
     mygreeting =    "I Love You! <3"
     def __init__(self, name, age, zodiac):
         self.name = name
         self.age =    age
         self.zodiac =    zodiac
     def crushnow(self):
            return "She is my  crush now!"
      
     def message(self):
            return  Lodi.mygreeting


crush1 =    Lodi("Bbibi", 24, "Pisces")

print(crush1.crushnow())

print(f"Name: {crush1.name}")
print(f"Age: {crush1.age}")
print(f"Zodiac sign: {crush1.zodiac}")

mymessage =    crush1.message()

print(mymessage)

Python:
class Lodi:
     mygreeting =    "I Love You! <3"
     def __init__(self, name, age, zodiac):
         self.name = name
         self.age =    age
         self.zodiac =    zodiac
     def crushnow(self):
            return "She is my  crush now!"
     
     def message(self):
            return  Lodi.mygreeting


crush1 =    Lodi("Bbibi", 24, "Pisces")

print(crush1.crushnow())

print(f"Name: {crush1.name}")
print(f"Age: {crush1.age}")
print(f"Zodiac sign: {crush1.zodiac}")

mymessage =    crush1.message()

print(mymessage)
I'm not a pro ๐Ÿ˜ ... Still learning this Language ... ๐Ÿค—
 

Attachments

  • lv_0_20220115185342.mp4
    12.1 MB
Code:
class Guest:
    pass

g_1 = Guest()

g_1.first = "Eve"
g_1.last = "Dela Cruz"
g_1.interest = "Anime"
g_1.phone = 12345

print(g_1.interest)

g_2 = Guest()

g_2.first = "Adam"
g_2.last = "Perez"
g_2.interest = "Russian literature"
g_2.phone = 87654

print(g_2.phone)

print(g_1.first,g_1.last,"and",g_2.first,g_2.last)
 
Status
Not open for further replies.

About this Thread

  • 3
    Replies
  • 689
    Views
  • 4
    Participants
Last reply from:
GORUN

Online now

Members online
943
Guests online
880
Total visitors
1,823

Forum statistics

Threads
2,276,248
Posts
28,968,633
Members
1,231,182
Latest member
ewan19292762
Back
Top