Instance Methods

Mon 10 August 2026
class Person:
    def __init__(self, name):
        self.name = name

    def greet(self):
        return f"Hello, my name is {self.name}"

p = Person("Alice")
print(p.greet())
Hello, my name is Alice


Score: 10

Category: chapter1_oop_basics

Read More

Listing Files And Directories

Mon 10 August 2026
import os

items = os.listdir(".")
print(items)
[' Avoiding Global Abuse (Best Practice Warning).ipynb', ' Base Case and Recursive Case.ipynb', ' Changing the Working Directory.ipynb', ' Creating and Using a Custom Module.ipynb', ' Global Keyword Inside Nested Functions.ipynb', ' Importing a Module.ipynb', ' Main Function for Program Flow Control.ipynb', ' Production …

Category: chapter12_file_handling

Read More
Page 8 of 20

« Prev Next »