Skip to content

Updated the code in single files #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Chapter 1 - PS/Mypractice1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
print(''' A sailor went to sea, sea, sea,
To see what he could see, see, see.
But all that he could see, see, see,
Was the bottom of the deep blue sea, sea, sea.''')
24 changes: 0 additions & 24 deletions Chapter 1 - PS/Problem1.py

This file was deleted.

6 changes: 5 additions & 1 deletion Chapter 1 - PS/Problem3.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import pyttsx3
# This is text-to-speech conversion library in Python


# Usage :
engine = pyttsx3.init()
engine.say("Hey I am good")
engine.say("This is amazing!")
engine.runAndWait()
2 changes: 1 addition & 1 deletion Chapter 1 - PS/Problem4.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

# Select the directory whose content you want to list
directory_path = '/'
directory_path = '/AfterClass Learning/Python-Practice'

# Use the os module to list the directory content
contents = os.listdir(directory_path)
Expand Down
3 changes: 2 additions & 1 deletion Chapter 1/first.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
print("Hello World")
print("Hello World")
print ("Learning Python")
10 changes: 4 additions & 6 deletions Chapter 1/module.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import pyjokes

# print("Printing Jokes...")

# This prints a random joke
joke = pyjokes.get_joke()
print(joke)

print('-------------------------------------------------------------------------------')

anotherJoke = pyjokes.get_joke()
print(anotherJoke)

# so thanks
# that was my program
# another line
# Yet another line
5 changes: 3 additions & 2 deletions Chapter 2 - PS/01_problem1.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
a = 1

c = 4
b = 5
d = 6

print(a + b)
print(a + b + c + d)
2 changes: 1 addition & 1 deletion Chapter 2 - PS/02_problem2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

b = 5

print("Remainder when a is divided by b is", a % b)
print ("Remainder when a is divided by b is", a % b)
5 changes: 4 additions & 1 deletion Chapter 2 - PS/03_problem3.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Always String type default
a = input("Enter the value of a: ")
print(type(a))
b = input("Enter the value of b: ")
print(type(a))
print(type(b))
7 changes: 6 additions & 1 deletion Chapter 2 - PS/04_problem4.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
a = int(input("Enter number 1: "))
b = int(input("Enter number 2: "))

print("a is greater than b is", a>b)
c = 34
d = 80

print("a is greater than b is", a>b)
print("c is greater than d is", c==d)

8 changes: 7 additions & 1 deletion Chapter 2 - PS/05_problem5.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@
b = int(input("Enter number 2: "))


print("The average of these two number is", (a+b)/2)
print("The average of these two number is", (a+b)/2)

e = int(input("Enter number 4: "))
f = int(input("Enter number 5: "))

print("Average of e and f is ", (e+f)/2)

6 changes: 5 additions & 1 deletion Chapter 2 - PS/06_problem6.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
a = int(input("Enter your number: "))
e = int(input("Enter your number: "))


print("The square of the number is", a**2)
print("The square of the number is", a*a)
# print("The square of the number is", a*a)

print("Square of e is ", e**2)

# print("The square of the number is", a^2) # Incorrect for finding square of a number in Python
11 changes: 8 additions & 3 deletions Chapter 2/01_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

c = 7

name = "harry"

print(a + b)
name = "Aakash"
singleQuote = 'akash'

print(a + b)
print(a + c + b)
print(c + b)
print(name)
print(singleQuote)
10 changes: 8 additions & 2 deletions Chapter 2/02_datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@

b = 5.22 # b is a floating point number

c = "Harry" # c is a string
c = "Aakash" # c is a string

d = False # d is a boolean variable

e = None # e is a none type variable
e = None # e is a none type variable

print(a)
print(b)
print(c)
print(d)
print(e)
8 changes: 5 additions & 3 deletions Chapter 2/03_rules_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

aaa = 435

harry = 34
aakash = 34

sameer = 45
hitesh = 45

_samerr = 34

# @sameer = 56 # Invalid due to @ symbol
# s@meer # Invalid due to @ symbol
# s@meer # Invalid due to @ symbol

print(_samerr)
6 changes: 3 additions & 3 deletions Chapter 2/04_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
# Comparison Operators

d = 5==5

print(d)

print(d)
# Output true and false

# Logical Operators

Expand All @@ -35,4 +34,5 @@
print("False and True is ", False and True)
print("False and False is ", False and False)

# The operator that changes True and False in opposite is called not.
print(not(True))
5 changes: 4 additions & 1 deletion Chapter 2/05_type.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
a = "31.2"
b = float(a) # a but the type should be float
t = type(b)
d = "string"

print(t)
print(t)
print(type(a))
print(type(d))
3 changes: 2 additions & 1 deletion Chapter 2/06_input.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
a = int(input("Enter number 1: "))
a = int(input("Enter number 1: "))
# Input function is let user allow user put input

b = int(input("Enter number 2: "))

Expand Down
3 changes: 0 additions & 3 deletions Chapter 3 - PS/01_problem1.py

This file was deleted.

3 changes: 2 additions & 1 deletion Chapter 3 - PS/02_problem2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
You are selected!
<|Date|> '''

print(letter.replace("<|Name|>", "Harry").replace("<|Date|", "24 September 2050"))
print(letter.replace("<|Name|>", "Aakash").replace("<|Date|>", "20 Oct 2025"))
# Chaining is happening here
38 changes: 38 additions & 0 deletions Chapter 3 - PS/03_practice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
nameInput = input("Please enter your name:")

print("Good afternoon",nameInput,"!!")
print(f"Good afternoon, {nameInput}!!") # Add f is mandatory

print("------------------------------------------------------------------------------------------------------------------")

name = input("Please enter your name: ")
date = input("Please enter date: ")

letter = (f'''Dear {name},
You are selected!
{date}''')

print(letter)

print("------------------------------------------------------------------------------------------------------------------")

text = "I am a great programer"

print(text.find(" "))

print("------------------------------------------------------------------------------------------------------------------")

para = "I am a great programer"

print(para.find(" "))


len = para.replace(" ", " ")
print(len)
print(len.find(" "))

print("------------------------------------------------------------------------------------------------------------------")

change = "Dear Aakash,\nThis python course is nice.\n\t\tThanks!"
print(change)

2 changes: 1 addition & 1 deletion Chapter 3 - PS/03_problem3.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name = "Harry is a good boy and "
name = "Aakash is a good boy and"

print(name.find(" "))
2 changes: 1 addition & 1 deletion Chapter 3 - PS/04_problem4.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = "Harry is a good boy and "
name = "Aakash is a good boy."

print(name.replace(" ", " "))
print(name) # Strings are immutable which means that you cannot change them by running functions on them
2 changes: 1 addition & 1 deletion Chapter 3 - PS/05_problem5.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
letter = "Dear Harry,\n\tThis python course is nice.\nThanks!"
letter = "Dear Aakash,\n\tThis python course is nice.\nThanks!"

print(letter)
11 changes: 9 additions & 2 deletions Chapter 3/01_intro_to_strings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name = "Harry"
name = "Aakash"

nameshort = name[0:3] # start from index 0 all the way till 3 (excluding 3)
print(nameshort)
character1 = name[1]
print(character1)
character0 = name[0]
print(character1)
print(character0)
print(name[0:5])
print(name[-1])
print(name[-2])
print(name[-3])
print(len(name))
5 changes: 3 additions & 2 deletions Chapter 3/02_negative_slicing.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name = "Harry"
name = "Aakash"

print(name[0:3])

print(name[-4: -1])
print(name[1:4])

print(name[:4]) # is same as print(name[0:4])
print(name[:5]) # is same as print(name[0:4])
print(name[:]) # complete length
print(name[1:]) # is same as print(name[1:5])
print(name[1:5])
11 changes: 7 additions & 4 deletions Chapter 3/03_str_functions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name = "harry"
name = "aakash sachdev"

print(len(name))
print(name.endswith("rry"))
print(name.startswith("ha"))
print(name.capitalize())
print(name.endswith("sh"))
print(name.endswith("rry"))
print(name.startswith("Aa")) # False cuz it is capital sensitive
print(name.capitalize())
print(name.title())
print(name.upper())
2 changes: 1 addition & 1 deletion Chapter 3/04_escape_seq.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
a = 'Harry is a good boy\nbut not a bad \'boy\''
a = 'Aakash is a good boy\nbut not a bad\t \n\"boy\"'


print(a)
9 changes: 9 additions & 0 deletions Chapter 3/05_skip_value.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# skip value

a = "0123456789"

print(a[1:7:2])

b = "abcdefghijklmnopqrstuvwxwz"

print(b[1:9:4])
5 changes: 1 addition & 4 deletions Chapter 4 - PS/01_problem1.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# This will return the list with fruit inputed user.
fruits = []

f1 = input("Enter Fruit name: ")
Expand All @@ -10,9 +11,5 @@
fruits.append(f4)
f5 = input("Enter Fruit name: ")
fruits.append(f5)
f6 = input("Enter Fruit name: ")
fruits.append(f6)
f7 = input("Enter Fruit name: ")
fruits.append(f7)

print(fruits)
3 changes: 3 additions & 0 deletions Chapter 4 - PS/02_problem2.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This will return the list with Marks in sorted manner.


marks = []

f1 = int(input("Enter Marks here: "))
Expand Down
Loading