Skip to content

Commit 829631c

Browse files
committed
Initial Commit
1 parent c0b76f8 commit 829631c

File tree

208 files changed

+2248
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

208 files changed

+2248
-2
lines changed

Chapter 1 - PS/Problem1.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
print(''' Twinkle, twinkle, little star,
2+
How I wonder what you are!
3+
Up above the world so high,
4+
Like a diamond in the sky.
5+
6+
When the blazing sun is gone,
7+
When he nothing shines upon,
8+
Then you show your little light,
9+
Twinkle, twinkle, all the night.
10+
11+
Then the trav'ller in the dark,
12+
Thanks you for your tiny spark,
13+
He could not see which way to go,
14+
If you did not twinkle so.
15+
16+
In the dark blue sky you keep,
17+
And often thro' my curtains peep,
18+
For you never shut your eye,
19+
Till the sun is in the sky.
20+
21+
'Tis your bright and tiny spark,
22+
Lights the trav'ller in the dark:
23+
Tho' I know not what you are,
24+
Twinkle, twinkle, little star.''')

Chapter 1 - PS/Problem2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Done using REPL

Chapter 1 - PS/Problem3.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import pyttsx3
2+
engine = pyttsx3.init()
3+
engine.say("Hey I am good")
4+
engine.runAndWait()

Chapter 1 - PS/Problem4.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import os
2+
3+
# Select the directory whose content you want to list
4+
directory_path = '/'
5+
6+
# Use the os module to list the directory content
7+
contents = os.listdir(directory_path)
8+
9+
# Print the contents of the directory
10+
print(contents)

Chapter 1/first.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print("Hello World")

Chapter 1/module.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import pyjokes
2+
3+
# print("Printing Jokes...")
4+
5+
# This prints a random joke
6+
joke = pyjokes.get_joke()
7+
print(joke)
8+
9+
10+
# so thanks
11+
# that was my program
12+
# another line
13+
# Yet another line

Chapter 10 - PS/01_problem1.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Programmer:
2+
company = "Microsoft"
3+
def __init__(self, name, salary, pin):
4+
self.name = name
5+
self.salary = salary
6+
self.pin = pin
7+
8+
9+
p = Programmer("Harry", 1200000, 245001)
10+
print(p.name, p.salary, p.pin, p.company)
11+
r = Programmer("Rohan", 1200000, 245001)
12+
print(r.name, r.salary, r.pin, r.company)

Chapter 10 - PS/02_problem2.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Calculator:
2+
def __init__(self, n):
3+
self.n = n
4+
5+
def square(self):
6+
print(f"The square is {self.n*self.n}")
7+
8+
def cube(self):
9+
print(f"The cube is {self.n*self.n*self.n}")
10+
11+
def squareroot(self):
12+
print(f"The squareroot is {self.n**1/2}")
13+
14+
a = Calculator(4)
15+
a.square()
16+
a.cube()
17+
a.squareroot()

Chapter 10 - PS/03_problem3.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Demo:
2+
a = 4
3+
4+
o = Demo()
5+
print(o.a) # Prints the class attribute because instance attribute is not present
6+
o.a = 0 # Instance attribute is set
7+
print(o.a) # Prints the instance attribute because instance attribute is present
8+
print(Demo.a) # Prints the class attribute

Chapter 10 - PS/04_problem4.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
class Calculator:
2+
def __init__(self, n):
3+
self.n = n
4+
5+
def square(self):
6+
print(f"The square is {self.n*self.n}")
7+
8+
def cube(self):
9+
print(f"The cube is {self.n*self.n*self.n}")
10+
11+
def squareroot(self):
12+
print(f"The squareroot is {self.n**1/2}")
13+
14+
@staticmethod
15+
def hello():
16+
print("Hello there!")
17+
18+
a = Calculator(4)
19+
a.hello()
20+
a.square()
21+
a.cube()
22+
a.squareroot()

0 commit comments

Comments
 (0)