Skip to content
Open
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
7 changes: 5 additions & 2 deletions 01_Day_Introduction/helloworld.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
print(3 + 2) # addition(+)
print(3 - 2) # subtraction(-)
print(3 * 2) # multiplication(*)
print(3 / 2) # division(/)
print(3 ** 2) # exponential(**)
print(3 / 2) # division(/)
print(3 % 2) # modulus(%)
print(3 // 2) # Floor division operator(//)

Expand All @@ -22,4 +22,7 @@
print(type('Asabeneh')) # String
print(type([1, 2, 3])) # List
print(type({'name': 'Asabeneh'})) # Dictionary
print(type({9.8, 3.14, 2.7})) # Tuple
print(type({9.8, 3.14, 2.7})) # Set
print(type((9.8, 3.14, 2.7))) # Tuple
print(type(True)) # Bool
print(type(None)) # NoneType
13 changes: 13 additions & 0 deletions 02_Day_2/variables.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Day 2: 30 Days of Python Programming

first_name = "Bhratesh"
Last_name = "Dhangar"
Full_name = "Bhratesh Dhangar"
Country_name = "India"
City_name = "Pune"
Age = 27
Year = 2024
Is_married = False
Is_true = True
Is_light_on = True
First_name, Last_name, Age = "Bhratesh", "Dhangar", 27
82 changes: 42 additions & 40 deletions 03_Day_Operators/day-3.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# Arithmetic Operations in Python
# Integers

print('Addition: ', 1 + 2)
print('Subtraction: ', 2 - 1)
print('Multiplication: ', 2 * 3)
print(f'Addition: {1 + 2}')
print(f'Subtraction: {2 - 1}')
print(f'Multiplication: {2 * 3}')
# Division in python gives floating number
print('Division: ', 4 / 2)
print('Division: ', 6 / 2)
print('Division: ', 7 / 2)
print(f'Division: {4 / 2}')
print(f'Division: {6 / 2}')
print(f'Division: {7 / 2}')
# gives without the floating number or without the remaining
print('Division without the remainder: ', 7 // 2)
print('Modulus: ', 3 % 2) # Gives the remainder
print('Division without the remainder: ', 7 // 3)
print('Exponential: ', 3 ** 2) # it means 3 * 3
print(f'Division without the remainder: {7 // 2}')
print(f'Modulus: {3 % 2}') # Gives the remainder
print(f'Division without the remainder: {7 // 3}')
print(f'Exponential: {3 ** 2}') # it means 3 * 3

# Floating numbers
print('Floating Number,PI', 3.14)
print('Floating Number, gravity', 9.81)
print(f'Floating Number, PI: {3.14}')
print(f'Floating Number, gravity: {9.81}')

# Complex numbers
print('Complex number: ', 1+1j)
print('Multiplying complex number: ', (1+1j) * (1-1j))
print(f'Complex number: {1+1j}')
print(f'Multiplying complex number: {(1+1j) * (1-1j)}')

# Declaring the variable at the top first

Expand All @@ -38,13 +38,13 @@

# I should have used sum instead of total but sum is a built-in function try to avoid overriding builtin functions
print(total) # if you don't label your print with some string, you never know from where is the result is coming
print('a + b = ', total)
print('a - b = ', diff)
print('a * b = ', product)
print('a / b = ', division)
print('a % b = ', remainder)
print('a // b = ', floor_division)
print('a ** b = ', exponential)
print(f'a + b = {total}')
print(f'a - b = {diff}')
print(f'a * b = {product}')
print(f'a / b = {division}')
print(f'a % b = {remainder}')
print(f'a // b = {floor_division}')
print(f'a ** b = {exponential}')

# Declaring values and organizing them together
num_one = 3
Expand All @@ -58,24 +58,24 @@
remainder = num_two % num_one

# Printing values with label
print('total: ', total)
print('difference: ', diff)
print('product: ', product)
print('division: ', div)
print('remainder: ', remainder)
print(f'total: {total}')
print(f'difference: {diff}')
print(f'product: {product}')
print(f'division: {div}')
print(f'remainder: {remainder}')


# Calculating area of a circle
radius = 10 # radius of a circle
# two * sign means exponent or power
area_of_circle = 3.14 * radius ** 2
print('Area of a circle:', area_of_circle)
print(f'Area of a circle: {area_of_circle}')

# Calculating area of a rectangle
length = 10
width = 20
area_of_rectangle = length * width
print('Area of rectangle:', area_of_rectangle)
print(f'Area of rectangle: {area_of_rectangle}')

# Calculating a weight of an object
mass = 75
Expand All @@ -99,22 +99,24 @@
print(len('python') > len('dragon')) # False

# Boolean comparison
print('True == True: ', True == True)
print('True == False: ', True == False)
print('False == False:', False == False)
print('True and True: ', True and True)
print('True or False:', True or False)
print(f'True == True: {True == True}')
print(f'True == False: {True == False}')
print(f'False == False: {False == False}')
print(f'True and True: {True and True}')
print(f'True or False: {True or False}')

# Another way comparison
# 'is' checks for object identity, while '==' checks for value equality.
# For comparing values (like numbers), it is safer to use '=='.
# True - because the data values are the same
print('1 is 1', 1 is 1)
print('1 is not 2', 1 is not 2) # True - because 1 is not 2
print('A in Asabeneh', 'A' in 'Asabeneh') # True - A found in the string
print('B in Asabeneh', 'B' in 'Asabeneh') # False -there is no uppercase B
print(f'1 is 1: {1 is 1}')
print(f'1 is not 2: {1 is not 2}') # True - because 1 is not 2
print(f"'A' in 'Asabeneh': {'A' in 'Asabeneh'}") # True - A found in the string
print(f"'B' in 'Asabeneh': {'B' in 'Asabeneh'}") # False -there is no uppercase B
# True - because coding for all has the word coding
print('coding' in 'coding for all')
print('a in an:', 'a' in 'an') # True
print('4 is 2 ** 2:', 4 is 2 ** 2) # True
print(f"'coding' in 'coding for all': {'coding' in 'coding for all'}")
print(f"'a' in 'an': {'a' in 'an'}") # True
print(f'4 is 2 ** 2: {4 is 2 ** 2}') # True, but using '==' is recommended for value comparison

print(3 > 2 and 4 > 3) # True - because both statements are true
print(3 > 2 and 4 < 3) # False - because the second statement is false
Expand Down