diff --git a/README.md b/README.md deleted file mode 100644 index c7325d6..0000000 --- a/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Python3CompleteCourse -This is the public repository for the course Python 3 Complete Course in Udemy. -All the sections are PyCharm Projects. -Open the Project in your PyCharm instance and enjoy the course. -Wish you a happy course. diff --git a/Section1/.idea/.gitignore b/Section1/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/Section1/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/Section1/.idea/Section1.iml b/Section1/.idea/Section1.iml deleted file mode 100644 index 8388dbc..0000000 --- a/Section1/.idea/Section1.iml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Section1/.idea/inspectionProfiles/profiles_settings.xml b/Section1/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2d..0000000 --- a/Section1/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/Section1/.idea/misc.xml b/Section1/.idea/misc.xml deleted file mode 100644 index d56657a..0000000 --- a/Section1/.idea/misc.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Section1/.idea/modules.xml b/Section1/.idea/modules.xml deleted file mode 100644 index 4e2ff69..0000000 --- a/Section1/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Section1/.idea/vcs.xml b/Section1/.idea/vcs.xml deleted file mode 100644 index 6c0b863..0000000 --- a/Section1/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Section1/lecture1/Program1.py b/Section1/lecture1/Program1.py index 36473fb..ef68f33 100644 --- a/Section1/lecture1/Program1.py +++ b/Section1/lecture1/Program1.py @@ -1,15 +1,11 @@ -# Python program to check a number is even or odd - - -def checkEven(num): - if num%2 == 0: - return True - else: - return False - - -n = int(input("Enter Number \n")) -if checkEven(n): - print(n, " is Even") -else: - print(n, " is Odd") +# Python program to check a number is even or odd +def checkEven(num): + if num%2 == 0: + return True + else: + return False +n = int(input("Enter Number \n")) +if(checkEven(n)): + print(n," is Even") +else: + print(n," is Odd") diff --git a/Section1/lecture1/__init__.py b/Section1/lecture1/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section2/.idea/.gitignore b/Section2/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/Section2/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/Section2/.idea/Section2.iml b/Section2/.idea/Section2.iml deleted file mode 100644 index cd2de6a..0000000 --- a/Section2/.idea/Section2.iml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/Section2/.idea/inspectionProfiles/profiles_settings.xml b/Section2/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2d..0000000 --- a/Section2/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/Section2/.idea/misc.xml b/Section2/.idea/misc.xml deleted file mode 100644 index b33d185..0000000 --- a/Section2/.idea/misc.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Section2/.idea/modules.xml b/Section2/.idea/modules.xml deleted file mode 100644 index b9893db..0000000 --- a/Section2/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Section2/.idea/vcs.xml b/Section2/.idea/vcs.xml deleted file mode 100644 index 6c0b863..0000000 --- a/Section2/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Section2/lecture21/Program1.py b/Section2/lecture21/Program1.py deleted file mode 100644 index 8e23576..0000000 --- a/Section2/lecture21/Program1.py +++ /dev/null @@ -1 +0,0 @@ -print("Hello World") \ No newline at end of file diff --git a/Section2/lecture21/__init__.py b/Section2/lecture21/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section2/lecture22/Program1.py b/Section2/lecture22/Program1.py deleted file mode 100644 index e6d58d8..0000000 --- a/Section2/lecture22/Program1.py +++ /dev/null @@ -1,8 +0,0 @@ -# Program to print greeting message - -def greet(name): - print("Python greetings: Hello ", name) - - -str = input("Enter your Name \n") -greet(str) \ No newline at end of file diff --git a/Section2/lecture22/Program2.py b/Section2/lecture22/Program2.py deleted file mode 100644 index 3b0ba96..0000000 --- a/Section2/lecture22/Program2.py +++ /dev/null @@ -1,12 +0,0 @@ -# Program to find sum and average of n numbers - -n = num = int(input("Enter the limit \n")) -total = 0 -while n > 0: - total = total + int(input("Enter number \n")) - n = n - 1 -print("Sum of Numbers : ", total) -print("Average of Numbers : ", total/num) - - - diff --git a/Section2/lecture22/Program3.py b/Section2/lecture22/Program3.py deleted file mode 100644 index 4d38af0..0000000 --- a/Section2/lecture22/Program3.py +++ /dev/null @@ -1,11 +0,0 @@ -# Program to print factorial of a given number - -def factorial(n): - if n <= 0: - return 1 - else: - return n*factorial(n-1) - - -num = int(input("Enter the Number \n")) -print("Factorial of ", num," is ", factorial(num)) \ No newline at end of file diff --git a/Section2/lecture22/__init__.py b/Section2/lecture22/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section2/lecture23/Program1.py b/Section2/lecture23/Program1.py deleted file mode 100644 index cedc9b8..0000000 --- a/Section2/lecture23/Program1.py +++ /dev/null @@ -1,5 +0,0 @@ -# Program to show line comments in python -var1 = 12 # declaring variable -print(var1) # printing the variable -# var2 = 43 We can comment lines of code -print("Hrllo") \ No newline at end of file diff --git a/Section2/lecture23/Program2.py b/Section2/lecture23/Program2.py deleted file mode 100644 index c47ea05..0000000 --- a/Section2/lecture23/Program2.py +++ /dev/null @@ -1,15 +0,0 @@ -# Program to show multi line comments -def print_message(msg): - print(msg) - - -# line1 -# line2 -# line3 - -print_message("Hello Python") # line comment -""" - multi line string literal - line2 - line3 -""" \ No newline at end of file diff --git a/Section2/lecture23/Program3.py b/Section2/lecture23/Program3.py deleted file mode 100644 index ede153c..0000000 --- a/Section2/lecture23/Program3.py +++ /dev/null @@ -1,8 +0,0 @@ -# Program to show python doc string - -def multiply(a,b): - """ Function to multiply a and b""" - return a*b - - -print(multiply(12, 2)) diff --git a/Section2/lecture23/__init__.py b/Section2/lecture23/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section2/lecture24/Program1.py b/Section2/lecture24/Program1.py deleted file mode 100644 index 31a3302..0000000 --- a/Section2/lecture24/Program1.py +++ /dev/null @@ -1,11 +0,0 @@ -# Program to show different variables in Python -var1 = "Hello" -var2 = 12 -var3 = 12.12 -var4 = True -print("type of var1 is ", type(var1)) -print("type of var2 is ", type(var2)) -print("type of var3 is ", type(var3)) -print("type of var4 is ", type(var4)) - - diff --git a/Section2/lecture24/Program2.py b/Section2/lecture24/Program2.py deleted file mode 100644 index 8d8db36..0000000 --- a/Section2/lecture24/Program2.py +++ /dev/null @@ -1,6 +0,0 @@ -# Program to show variable naming formats - -EmployeeName = "David" # Pascal notation -employeeName = "David" # camel case notation -employee_name = "David" # snake case notation - diff --git a/Section2/lecture24/Program3.py b/Section2/lecture24/Program3.py deleted file mode 100644 index 6d17e88..0000000 --- a/Section2/lecture24/Program3.py +++ /dev/null @@ -1,6 +0,0 @@ -# Program to show valid and invalid variable names -# 1var = 12 invalid cannot start with number -var__1 = "hello" # valid can have any no of underscore in names -_var = 12 # valid can start with underscore -# $var = 32 invalid cannot start with $ - diff --git a/Section2/lecture24/Program4.py b/Section2/lecture24/Program4.py deleted file mode 100644 index 800139b..0000000 --- a/Section2/lecture24/Program4.py +++ /dev/null @@ -1,10 +0,0 @@ -# Program to show scopes of variable in Python -var1 = 10 - - -def change_value(): - var1 = 20 - - -change_value() -print("value of var1 after method call is ",var1) \ No newline at end of file diff --git a/Section2/lecture24/Program5.py b/Section2/lecture24/Program5.py deleted file mode 100644 index aedb353..0000000 --- a/Section2/lecture24/Program5.py +++ /dev/null @@ -1,16 +0,0 @@ -# Program to show global keyword -var2 = 10 - - -def func(): - var1 = 30 - print("local var1 = ", var1) - - global var2 - var2 = 20 - print("global var2 = ", var2) - - -func() - - diff --git a/Section2/lecture24/__init__.py b/Section2/lecture24/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section2/lecture25/Program1.py b/Section2/lecture25/Program1.py deleted file mode 100644 index 35d0d6d..0000000 --- a/Section2/lecture25/Program1.py +++ /dev/null @@ -1,2 +0,0 @@ -# Program to print keywords in Python -help("keywords") \ No newline at end of file diff --git a/Section2/lecture25/Program2.py b/Section2/lecture25/Program2.py deleted file mode 100644 index e487af2..0000000 --- a/Section2/lecture25/Program2.py +++ /dev/null @@ -1,4 +0,0 @@ -# Program to show keyword module in pythonn -import keyword -print(keyword.kwlist) # gets all keywords for a specific python version -print(" Number of keywords is ",len(keyword.kwlist)) diff --git a/Section2/lecture25/Program3.py b/Section2/lecture25/Program3.py deleted file mode 100644 index 61d9ce6..0000000 --- a/Section2/lecture25/Program3.py +++ /dev/null @@ -1,7 +0,0 @@ -# Program to check a string is a keyword -import keyword -str1 = "if" -print(str1, " is keyword ? ", keyword.iskeyword(str1)) - -str2 = "const" -print(str2, " is keyword ? ",keyword.iskeyword(str2)) \ No newline at end of file diff --git a/Section2/lecture25/__init__.py b/Section2/lecture25/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section2/main.py b/Section2/main.py deleted file mode 100644 index 5596b44..0000000 --- a/Section2/main.py +++ /dev/null @@ -1,16 +0,0 @@ -# This is a sample Python script. - -# Press Shift+F10 to execute it or replace it with your code. -# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. - - -def print_hi(name): - # Use a breakpoint in the code line below to debug your script. - print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint. - - -# Press the green button in the gutter to run the script. -if __name__ == '__main__': - print_hi('PyCharm') - -# See PyCharm help at https://www.jetbrains.com/help/pycharm/ diff --git a/Section3/.idea/.gitignore b/Section3/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/Section3/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/Section3/.idea/Section3.iml b/Section3/.idea/Section3.iml deleted file mode 100644 index 70d4f20..0000000 --- a/Section3/.idea/Section3.iml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/Section3/.idea/inspectionProfiles/profiles_settings.xml b/Section3/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2d..0000000 --- a/Section3/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/Section3/.idea/misc.xml b/Section3/.idea/misc.xml deleted file mode 100644 index 541e003..0000000 --- a/Section3/.idea/misc.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Section3/.idea/modules.xml b/Section3/.idea/modules.xml deleted file mode 100644 index 89a52b9..0000000 --- a/Section3/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Section3/.idea/vcs.xml b/Section3/.idea/vcs.xml deleted file mode 100644 index 6c0b863..0000000 --- a/Section3/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Section3/lecture31/Program1.py b/Section3/lecture31/Program1.py deleted file mode 100644 index 9980083..0000000 --- a/Section3/lecture31/Program1.py +++ /dev/null @@ -1,10 +0,0 @@ -# program to declare and use numbers in Python -var1 = 123 -print(type(var1), " value = ",var1) -var2 = 12.23 -print(type(var2), " value = ",var2) -var3 = 10e10 # we can use exponents -print(type(var3), " value = ",var3) -var4 = 10+20j # we can use complex num -print(type(var4), " value = ",var4) - diff --git a/Section3/lecture31/Program2.py b/Section3/lecture31/Program2.py deleted file mode 100644 index a6232e1..0000000 --- a/Section3/lecture31/Program2.py +++ /dev/null @@ -1,7 +0,0 @@ -# Program to show differnt type of number system -bin = 0b11101 -print("Value of bin = ", bin) -oct = 0o432 -print("Value of oct = ", oct) -hex = 0xFFF -print("Value of hex = ", hex) diff --git a/Section3/lecture31/Program3.py b/Section3/lecture31/Program3.py deleted file mode 100644 index 1d0268c..0000000 --- a/Section3/lecture31/Program3.py +++ /dev/null @@ -1,11 +0,0 @@ -# Program to show type conversion -var1 = 12.23 -var2 = int(var1) -print(var2) -var3 = 12 -var4 = float(var3) -print(var4) -var5 = "12.23" -var6 = float(var5) -print(var6) - diff --git a/Section3/lecture31/Program4.py b/Section3/lecture31/Program4.py deleted file mode 100644 index 0fc5d40..0000000 --- a/Section3/lecture31/Program4.py +++ /dev/null @@ -1,6 +0,0 @@ -# Program to show number functions - -print("abs() = ", abs(-12)) -print("max() = ", max(10, 2, 33, 44, 55, 11, 78)) -print("min() = ", min(10, 2, 33, 44, 55, 11, 78)) -print("round() = ", round(10.3459,2)) diff --git a/Section3/lecture31/__init__.py b/Section3/lecture31/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section3/lecture32/Program1.py b/Section3/lecture32/Program1.py deleted file mode 100644 index a7c3ac8..0000000 --- a/Section3/lecture32/Program1.py +++ /dev/null @@ -1,5 +0,0 @@ -# Program to show boolean data type -var1 = True -print("type = ", type(var1), ", Value = ", var1) -var2 = False -print("type = ", type(var2), ", Value = ", var2) diff --git a/Section3/lecture32/Program2.py b/Section3/lecture32/Program2.py deleted file mode 100644 index 8f73477..0000000 --- a/Section3/lecture32/Program2.py +++ /dev/null @@ -1,13 +0,0 @@ -# Program showing use of bool() - -var1 = bool(1) -print("var1 = ", var1) -var2 = bool(0) -print("var2 = ", var2) -var3 = bool("Hello") -print("var3 = ", var3) -var4 = bool("") -print("var4 = ", var4) - - - diff --git a/Section3/lecture32/__init__.py b/Section3/lecture32/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section3/lecture33/Program1.py b/Section3/lecture33/Program1.py deleted file mode 100644 index d8c29dd..0000000 --- a/Section3/lecture33/Program1.py +++ /dev/null @@ -1,14 +0,0 @@ -# Program to show different string declaration syntax - -str1 = "Hello world Double quotes" -str2 = 'Hello world single quotes' -str3 = """ Line1 - line2 - line3 Triple double quotes""" -str4 = ''' Line1 - line2 - line3 Triple single quotes''' -print("str1 = ", str1) -print("str2 = ", str2) -print("str3 = ", str3) -print("str4 = ", str4) diff --git a/Section3/lecture33/Program2.py b/Section3/lecture33/Program2.py deleted file mode 100644 index 7d3a763..0000000 --- a/Section3/lecture33/Program2.py +++ /dev/null @@ -1,10 +0,0 @@ -# Program to show different string methods - -str1 = "hello world" -print("length of str = ", len(str1)) -print("index() = ", str1.index("world")) -print("find() = ", str1.find("w")) -print("capitalize() = ", str1.capitalize()) - - - diff --git a/Section3/lecture33/Program3.py b/Section3/lecture33/Program3.py deleted file mode 100644 index 16fc02b..0000000 --- a/Section3/lecture33/Program3.py +++ /dev/null @@ -1,16 +0,0 @@ -# Program to show more String methods -str2 = "M" -print("isalpha() = ", str2.isalpha()) -str3 = "David" -print("join() = ", str3.join("[]")) -print("replace() = ", str3.replace("David","Paul")) -str4 = "Apple,Orange,Banana" -print("split() = ", str4.split(",")) -print("upper() = ", str4.upper()) - - - - - - - diff --git a/Section3/lecture33/Program4.py b/Section3/lecture33/Program4.py deleted file mode 100644 index 377b8b3..0000000 --- a/Section3/lecture33/Program4.py +++ /dev/null @@ -1,6 +0,0 @@ -# Program to show indexing of string - -str1 = "Welcome to Python" -print("indexing first position", str1[0]) -print("indexing last position = ", str1[len(str1)-1]) -print("negative indexing = ", str1[-1]) \ No newline at end of file diff --git a/Section3/lecture33/Program5.py b/Section3/lecture33/Program5.py deleted file mode 100644 index 2e1e86a..0000000 --- a/Section3/lecture33/Program5.py +++ /dev/null @@ -1,9 +0,0 @@ -# Program to show slicing string in Python - -str1 = "My name is David" -print("slicing string 1 = ", str1[:2]) -print("slicing string 2 = ", str1[3:7]) -print("slicing string 3 = ", str1[8:]) -str2 = "abcdefgh" -print("slicing string with step size = ", str2[::2]) -print("reversing string = ", str2[::-1]) \ No newline at end of file diff --git a/Section3/lecture33/Program6.py b/Section3/lecture33/Program6.py deleted file mode 100644 index 45029c3..0000000 --- a/Section3/lecture33/Program6.py +++ /dev/null @@ -1,7 +0,0 @@ -# Program to show different print formatting - -print("Hello {}".format("David")) -print("format = {0} {2} is {1}".format("My", "David", "Name")) -# using fstring -str1 = "David" -print(f" fstring = My name is {str1}") \ No newline at end of file diff --git a/Section3/lecture33/__init__.py b/Section3/lecture33/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section3/lecture34/Program1.py b/Section3/lecture34/Program1.py deleted file mode 100644 index ed3a9c8..0000000 --- a/Section3/lecture34/Program1.py +++ /dev/null @@ -1,9 +0,0 @@ -# Program to show declaration and usage of lists - -fruits_list = ["Apple", "Orange", "Banana", "Mango"] -print(" fruits_list = ", fruits_list) -print("iterating list items") -for item in fruits_list: - print("fruit : ", item) -list1 = [] # empty list -print("length of list1 = ", len(list1)) diff --git a/Section3/lecture34/Program2.py b/Section3/lecture34/Program2.py deleted file mode 100644 index 0d9a3c6..0000000 --- a/Section3/lecture34/Program2.py +++ /dev/null @@ -1,8 +0,0 @@ -# Program to show indexing and slicing a list - -name_list = ["David", "Paul", "Sam", "Adam"] -print("name_list first element = ", name_list[0]) -print("name_list last element = ", name_list[-1]) -print("name_list slicing first 2 elements = ", name_list[0:2]) -print("name_list reversing elements = ", name_list[::-1]) - diff --git a/Section3/lecture34/Program3.py b/Section3/lecture34/Program3.py deleted file mode 100644 index 366c79c..0000000 --- a/Section3/lecture34/Program3.py +++ /dev/null @@ -1,13 +0,0 @@ -# Program to show list methods - -cars = ["Skoda", "Toyota", "Ferrari", "BMW"] -print("list index ", cars.index("BMW")) -cars.append("Ford") -print(" after append = ", cars) -print(" after pop = ", cars.pop()) -cars.remove("Skoda") -print(" after remove = ", cars) -cars.insert(2, "Fiat") -print(" after insert = ", cars) -cars.clear() -print(" after clear = ", cars) \ No newline at end of file diff --git a/Section3/lecture34/__init__.py b/Section3/lecture34/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section3/lecture35/Program1.py b/Section3/lecture35/Program1.py deleted file mode 100644 index 60e37fe..0000000 --- a/Section3/lecture35/Program1.py +++ /dev/null @@ -1,8 +0,0 @@ -# Program to show declaration and usage of tuples - -days = ("sun", "mon", "tue", "wed", "thu", "fri", "sat") -print("Tuple days = ", days) -emp = () # empty tuple -print("empty tuple =", emp) -tup = (1,) # empty tuple -print("single element tuple =",tup) \ No newline at end of file diff --git a/Section3/lecture35/Program2.py b/Section3/lecture35/Program2.py deleted file mode 100644 index d63bacf..0000000 --- a/Section3/lecture35/Program2.py +++ /dev/null @@ -1,8 +0,0 @@ -# Program showing usage of 'in' with tuples - -days = ("sun", "mon", "tue", "wed", "thu", "fri", "sat") -if "mon" in days: - print("mon is present") - -if "jan" not in days: - print("jan is not present") \ No newline at end of file diff --git a/Section3/lecture35/Program3.py b/Section3/lecture35/Program3.py deleted file mode 100644 index 2074710..0000000 --- a/Section3/lecture35/Program3.py +++ /dev/null @@ -1,9 +0,0 @@ -# Program to show tuple unpacking in Python - -items = ("pen", "box", "ball", "paper") -(red, green, yellow, blue) = items -print("red = ",red) - -list1 = [(1, 2), (3, 4), (5, 6)] # llist of tuples -for (a, b) in list1: - print("(",a,",", b, ")") \ No newline at end of file diff --git a/Section3/lecture35/Program4.py b/Section3/lecture35/Program4.py deleted file mode 100644 index 6f3ae02..0000000 --- a/Section3/lecture35/Program4.py +++ /dev/null @@ -1,8 +0,0 @@ -# Program to show indexing and slicing a tuple - -tup1 = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) -print("first element ", tup1[0]) -print("last element ", tup1[-1]) -print("Slicing first 5 elements = ", tup1[:5]) -print("Slicing last 5 elements = ", tup1[5:]) -print("Slicing elements with step 2 = ", tup1[::2]) \ No newline at end of file diff --git a/Section3/lecture35/__init__.py b/Section3/lecture35/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section3/lecture36/Program1.py b/Section3/lecture36/Program1.py deleted file mode 100644 index 66052fb..0000000 --- a/Section3/lecture36/Program1.py +++ /dev/null @@ -1,11 +0,0 @@ -# Program to show declaration of sets in python - -set1 = {1, 2, 3, 4, 5, 6, 7, 8, 9} -print("set1 = ", set1) -set2 = set() # empty set -print(type(set2)) -set3 = {1,} -print("single element set = ", set3) -set4 = set(["a","b", "c"]) -print("set4 = ", set4) - diff --git a/Section3/lecture36/Program2.py b/Section3/lecture36/Program2.py deleted file mode 100644 index 48a2625..0000000 --- a/Section3/lecture36/Program2.py +++ /dev/null @@ -1,11 +0,0 @@ -# Program to show methods of set - -set1 = {1, 2, 3, 4} -set1.add(5) -print("after add = ", set1) -set2 = {6, 7, 8, 9} -print("union = ", set1.union(set2)) -set3 = {4, 5, 6, 7} -print("intersection = ", set2.intersection(set3)) -set1.discard(1) -print("after discard = ", set1) \ No newline at end of file diff --git a/Section3/lecture36/Program3.py b/Section3/lecture36/Program3.py deleted file mode 100644 index 7bd1bdf..0000000 --- a/Section3/lecture36/Program3.py +++ /dev/null @@ -1,4 +0,0 @@ -# Program to show frozen sets - -set1 = frozenset({1, 2, 3, 4, 5}) -print("Frozen set = ", set1) diff --git a/Section3/lecture36/__init__.py b/Section3/lecture36/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section3/lecture37/Program1.py b/Section3/lecture37/Program1.py deleted file mode 100644 index d189e50..0000000 --- a/Section3/lecture37/Program1.py +++ /dev/null @@ -1,9 +0,0 @@ -# Program to show declaration and usage of dictionaries - -dict1 = {"name": "David", "age": 31, "job": "instructor"} -print("dict1 = ", dict1) -print("dict1 name = ", dict1["name"]) -dict2 = {} # empty dictionary -print("empty dictionary = ", dict2) -dict1["age"] = 32 -print("dict1 after changing age ", dict1) diff --git a/Section3/lecture37/Program2.py b/Section3/lecture37/Program2.py deleted file mode 100644 index 6214bd4..0000000 --- a/Section3/lecture37/Program2.py +++ /dev/null @@ -1,8 +0,0 @@ -# Program to show dictionary methods - -dict1 = {"name": "David", "age": 31, "job": "instructor"} -print("keys : ", dict1.keys()) -print("values : ", dict1.values()) -for (k,v) in dict1.items(): - print(k, " -> ", v) - diff --git a/Section3/lecture37/__init__.py b/Section3/lecture37/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section3/main.py b/Section3/main.py deleted file mode 100644 index 5596b44..0000000 --- a/Section3/main.py +++ /dev/null @@ -1,16 +0,0 @@ -# This is a sample Python script. - -# Press Shift+F10 to execute it or replace it with your code. -# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. - - -def print_hi(name): - # Use a breakpoint in the code line below to debug your script. - print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint. - - -# Press the green button in the gutter to run the script. -if __name__ == '__main__': - print_hi('PyCharm') - -# See PyCharm help at https://www.jetbrains.com/help/pycharm/ diff --git a/Section4/.idea/.gitignore b/Section4/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/Section4/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/Section4/.idea/Section4.iml b/Section4/.idea/Section4.iml deleted file mode 100644 index 5bc1ae6..0000000 --- a/Section4/.idea/Section4.iml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/Section4/.idea/inspectionProfiles/profiles_settings.xml b/Section4/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2d..0000000 --- a/Section4/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/Section4/.idea/misc.xml b/Section4/.idea/misc.xml deleted file mode 100644 index b1a6c82..0000000 --- a/Section4/.idea/misc.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Section4/.idea/modules.xml b/Section4/.idea/modules.xml deleted file mode 100644 index 26caa1f..0000000 --- a/Section4/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Section4/.idea/vcs.xml b/Section4/.idea/vcs.xml deleted file mode 100644 index 6c0b863..0000000 --- a/Section4/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Section4/lecture41/Program1.py b/Section4/lecture41/Program1.py deleted file mode 100644 index 90047b5..0000000 --- a/Section4/lecture41/Program1.py +++ /dev/null @@ -1,15 +0,0 @@ -# program to show arithmetic operators -var1 = 20 -var2 = 10 -print("addition : ", (var1+var2)) -print("subtraction : ", (var1-var2)) -print("multiplication : ", (var1*var2)) -print("division : ", (var1/3)) -print("modulus : ", (var1%3)) -print("exponent : ", (var1**2)) -print("floor division : ", (var1//3)) - - - - - diff --git a/Section4/lecture41/Program2.py b/Section4/lecture41/Program2.py deleted file mode 100644 index eb3aaab..0000000 --- a/Section4/lecture41/Program2.py +++ /dev/null @@ -1,7 +0,0 @@ -# Program to show assignment operators - -var2 = var1 = 10 -print("var1 = ", var1) -print("var2 = ", var2) -var2 += 10 -print("var2 after compound assignment = ", var2) diff --git a/Section4/lecture41/Program3.py b/Section4/lecture41/Program3.py deleted file mode 100644 index c60f2e2..0000000 --- a/Section4/lecture41/Program3.py +++ /dev/null @@ -1,10 +0,0 @@ -# Program to show comparison operators in Python - -var1 = 1 -var2 = 2 -print("equals : ", (var1 == var2)) -print("greater : ", (var1 > var2)) -print("less : ", (var1 < var2)) -print(" not equals : ", (var1 != var2)) -print("grater and equals : ", (var1 >= var2)) -print("less and equals : ", (var1 <= var2)) diff --git a/Section4/lecture41/__init__.py b/Section4/lecture41/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section4/lecture42/Program1.py b/Section4/lecture42/Program1.py deleted file mode 100644 index 81d59d5..0000000 --- a/Section4/lecture42/Program1.py +++ /dev/null @@ -1,7 +0,0 @@ -# Program to show logical operators - -var1 = True -var2 = False -print("logical and : ", (var1 and var2)) -print("logical or : ", (var1 or var2)) -print("logical not : ", not var1) \ No newline at end of file diff --git a/Section4/lecture42/Program2.py b/Section4/lecture42/Program2.py deleted file mode 100644 index 49d86d5..0000000 --- a/Section4/lecture42/Program2.py +++ /dev/null @@ -1,8 +0,0 @@ -# Program to show identity operators - -var1 = "hello" -var2 = "hello" -var3 = "Hello" -print("var1 is var2 -> ", (var1 is var2)) -print("var1 is var3 -> ", (var1 is var3)) -print("var1 is not var3 -> ", (var1 is not var3)) \ No newline at end of file diff --git a/Section4/lecture42/Program3.py b/Section4/lecture42/Program3.py deleted file mode 100644 index 0d78064..0000000 --- a/Section4/lecture42/Program3.py +++ /dev/null @@ -1,7 +0,0 @@ -# Program to show membership operators - -list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9] -print("7 in list1 -> ", (7 in list1)) -print("10 not in list1 -> ", (10 not in list1)) - - diff --git a/Section4/lecture42/Program4.py b/Section4/lecture42/Program4.py deleted file mode 100644 index a1c33af..0000000 --- a/Section4/lecture42/Program4.py +++ /dev/null @@ -1,10 +0,0 @@ -# Program to show Bitwise operators in Python - -var1 = 0b1101 -var2 = 0b1001 -print("var1 & var2 = ", (var1 & var2)) -print("var1 | var2 = ", (var1 | var2)) -print("var1 ^ var2 = ", (var1 ^ var2)) -print("~var1 = ",(~var1)) -print("var1 << 2 = ", (var1 << 2)) -print("var1 >> 2 = ", (var1 >> 2)) \ No newline at end of file diff --git a/Section4/lecture42/__init__.py b/Section4/lecture42/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section4/lecture43/Program1.py b/Section4/lecture43/Program1.py deleted file mode 100644 index 50ff810..0000000 --- a/Section4/lecture43/Program1.py +++ /dev/null @@ -1,8 +0,0 @@ -# Program to find largest of two numbers using if block - -var1 = int(input("Enter number 1 \n")) -var2 = int(input("Enter number 2 \n")) -if var1 > var2: - print("{} is greater than {}".format(var1, var2)) -if var2 > var1: - print("{} is greater than {}".format(var2, var1)) \ No newline at end of file diff --git a/Section4/lecture43/Program2.py b/Section4/lecture43/Program2.py deleted file mode 100644 index ded3f66..0000000 --- a/Section4/lecture43/Program2.py +++ /dev/null @@ -1,7 +0,0 @@ -# Program to show use of if and else blocks - -var1 = 10 -if var1 < 5: - print("less than 5") -else: - print("greater than 5") diff --git a/Section4/lecture43/Program3.py b/Section4/lecture43/Program3.py deleted file mode 100644 index d817545..0000000 --- a/Section4/lecture43/Program3.py +++ /dev/null @@ -1,13 +0,0 @@ -# Program to find largest of three numbers - -var1 = int(input("Enter number 1: \n")) -var2 = int(input("Enter number 2: \n")) -var3 = int(input("Enter number 3: \n")) -if var2 > var1: - largest = var2 -elif var1 > var2: - largest = var1 -if var3 > largest: - largest = var3 -print("largest value among {},{} and {} is {}" - .format(var1, var2, var3, largest)) \ No newline at end of file diff --git a/Section4/lecture43/__init__.py b/Section4/lecture43/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section4/lecture44/Program1.py b/Section4/lecture44/Program1.py deleted file mode 100644 index 6c83ac2..0000000 --- a/Section4/lecture44/Program1.py +++ /dev/null @@ -1,7 +0,0 @@ -# Program to print multiplication table using for in loop - -for n in range(1, 10): - print("Table of {}".format(n)) - for m in range(1, 10): - print("{} x {} = {}".format(n, m, (n*m))) - print("--------------------") diff --git a/Section4/lecture44/Program2.py b/Section4/lecture44/Program2.py deleted file mode 100644 index ed57229..0000000 --- a/Section4/lecture44/Program2.py +++ /dev/null @@ -1,8 +0,0 @@ -# Program to find factorial of a number using while loop - -n = num = int(input("Enter number \n")) -fact = num -while num > 1: - fact *= num - 1 - num = num - 1 -print("factorial of {} = {}".format(n, fact)) \ No newline at end of file diff --git a/Section4/lecture44/Program3.py b/Section4/lecture44/Program3.py deleted file mode 100644 index 6004568..0000000 --- a/Section4/lecture44/Program3.py +++ /dev/null @@ -1,16 +0,0 @@ -# Program to print a triangle of stars - -pyramid = "" -length = 12 -a = length//2 -b = a+1 -for n in range(0,length//2): - for m in range(0, length +1): - if a <= m < b: - pyramid += "*" - else: - pyramid += " " - a = a - 1 - b = b + 1 - pyramid += "\n" -print(pyramid) \ No newline at end of file diff --git a/Section4/lecture44/Program4.py b/Section4/lecture44/Program4.py deleted file mode 100644 index 3fa1a11..0000000 --- a/Section4/lecture44/Program4.py +++ /dev/null @@ -1,9 +0,0 @@ -# Program to reverse a number - -num = int(input("|Enter number \n")) -print("number = ", num) -rev = 0 -while num != 0: - rev = rev*10 + num%10 - num = num//10 -print("reverse = ", rev) \ No newline at end of file diff --git a/Section4/lecture44/Program5.py b/Section4/lecture44/Program5.py deleted file mode 100644 index 589d4cc..0000000 --- a/Section4/lecture44/Program5.py +++ /dev/null @@ -1,12 +0,0 @@ -# Program to show use of else in for and while loops - -for item in (1, 2, 3, 4, 5): - print("item = ", item) -else: - print("else block") -n = 5 -while n>0: - print("n = ", n) - n = n - 1 -else: - print("else block") diff --git a/Section4/lecture44/__init__.py b/Section4/lecture44/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section4/lecture45/Program1.py b/Section4/lecture45/Program1.py deleted file mode 100644 index 25a863b..0000000 --- a/Section4/lecture45/Program1.py +++ /dev/null @@ -1,6 +0,0 @@ -# program showing use of break statement - -for n in range(0, 10): - if n == 5: - break - print("n = ", n) \ No newline at end of file diff --git a/Section4/lecture45/Program2.py b/Section4/lecture45/Program2.py deleted file mode 100644 index f16e5a0..0000000 --- a/Section4/lecture45/Program2.py +++ /dev/null @@ -1,8 +0,0 @@ -# Program to show use of continue statement - -for n in range(0, 10): - if n == 5: - continue - print(" n = ", n) - - diff --git a/Section4/lecture45/Program3.py b/Section4/lecture45/Program3.py deleted file mode 100644 index 090a08f..0000000 --- a/Section4/lecture45/Program3.py +++ /dev/null @@ -1,6 +0,0 @@ -# Program to show use of pass statement - -for n in range(0, 10): - if n == 3: - pass - print(" n =",n) \ No newline at end of file diff --git a/Section4/lecture45/__init__.py b/Section4/lecture45/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section4/main.py b/Section4/main.py deleted file mode 100644 index 5596b44..0000000 --- a/Section4/main.py +++ /dev/null @@ -1,16 +0,0 @@ -# This is a sample Python script. - -# Press Shift+F10 to execute it or replace it with your code. -# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. - - -def print_hi(name): - # Use a breakpoint in the code line below to debug your script. - print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint. - - -# Press the green button in the gutter to run the script. -if __name__ == '__main__': - print_hi('PyCharm') - -# See PyCharm help at https://www.jetbrains.com/help/pycharm/ diff --git a/Section5/.idea/.gitignore b/Section5/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/Section5/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/Section5/.idea/Section5.iml b/Section5/.idea/Section5.iml deleted file mode 100644 index 104c946..0000000 --- a/Section5/.idea/Section5.iml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/Section5/.idea/inspectionProfiles/profiles_settings.xml b/Section5/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2d..0000000 --- a/Section5/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/Section5/.idea/misc.xml b/Section5/.idea/misc.xml deleted file mode 100644 index f2ef1b4..0000000 --- a/Section5/.idea/misc.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Section5/.idea/modules.xml b/Section5/.idea/modules.xml deleted file mode 100644 index c828b5c..0000000 --- a/Section5/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Section5/.idea/vcs.xml b/Section5/.idea/vcs.xml deleted file mode 100644 index 6c0b863..0000000 --- a/Section5/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Section5/lecture51/Program1.py b/Section5/lecture51/Program1.py deleted file mode 100644 index 8d1bed2..0000000 --- a/Section5/lecture51/Program1.py +++ /dev/null @@ -1,5 +0,0 @@ -# Program to show list comprehension in Python - -list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9] -list2 = [n**2 for n in list1] -print("list2 = ", list2) \ No newline at end of file diff --git a/Section5/lecture51/Program2.py b/Section5/lecture51/Program2.py deleted file mode 100644 index 047ed16..0000000 --- a/Section5/lecture51/Program2.py +++ /dev/null @@ -1,6 +0,0 @@ -# program to filter a list and create new list - -list1 = ["David", "Sam", - "Adam", "Don", "Fred", "Dante", "Paul"] -filtered_list = [s for s in list1 if s.startswith("D")] -print("Filtered list : ", filtered_list) \ No newline at end of file diff --git a/Section5/lecture51/Program3.py b/Section5/lecture51/Program3.py deleted file mode 100644 index 984744d..0000000 --- a/Section5/lecture51/Program3.py +++ /dev/null @@ -1,5 +0,0 @@ -# Program to show set comprehension - -set1 = {1, 2, 3, 4, 5} -set2 = { n**2 for n in set1} -print("set2 = ",set2) \ No newline at end of file diff --git a/Section5/lecture51/__init__.py b/Section5/lecture51/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section5/lecture52/Program1.py b/Section5/lecture52/Program1.py deleted file mode 100644 index 6b41abc..0000000 --- a/Section5/lecture52/Program1.py +++ /dev/null @@ -1,7 +0,0 @@ -# Program to show dictionary comprehension - -keys = ["David", "Paul", "Jose", "Adam"] -values = [32, 31, 39, 35] -user_dict = {x:y for (x,y) in zip(keys, values)} -print("user_dict = ", user_dict) - diff --git a/Section5/lecture52/Program2.py b/Section5/lecture52/Program2.py deleted file mode 100644 index 4a63643..0000000 --- a/Section5/lecture52/Program2.py +++ /dev/null @@ -1,5 +0,0 @@ -# Program to convert a list to a dictionary - -list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9] -square_dict = {n: n**2 for n in list1} -print("square dict = ", square_dict) diff --git a/Section5/lecture52/Program3.py b/Section5/lecture52/Program3.py deleted file mode 100644 index ed32e7b..0000000 --- a/Section5/lecture52/Program3.py +++ /dev/null @@ -1,6 +0,0 @@ -# Program to filter a dictionary - -user_dict = {"David": 32, "Adam": 34, "Sam": 46, - "Paul": 34, "John": 36} -filtered_dict = {x: y for (x, y) in user_dict.items() if y > 35} -print("filtered_dict = ", filtered_dict) \ No newline at end of file diff --git a/Section5/lecture52/__init__.py b/Section5/lecture52/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section5/lecture53/Program1.py b/Section5/lecture53/Program1.py deleted file mode 100644 index 0b5d88d..0000000 --- a/Section5/lecture53/Program1.py +++ /dev/null @@ -1,16 +0,0 @@ -# Program to show *args in Python - -def add(*args): - add = 0 - for n in args: - add += n - return add - - -print("add() = ", add()) -print("add(12) = ", add(12)) -print("add(10,20) = ", add(10, 20)) -print("add(1,2,3,4) = ", add(1, 2, 3, 4)) - - - diff --git a/Section5/lecture53/Program2.py b/Section5/lecture53/Program2.py deleted file mode 100644 index 5778bcc..0000000 --- a/Section5/lecture53/Program2.py +++ /dev/null @@ -1,21 +0,0 @@ -# Program to show args and normal arguments together - -def add(types="int", *args): - if types == "int": - add = 0 - for n in args: - add += n - return add - elif types == "float": - add = 0.0 - for n in args: - add += n - return add - else: - return 0 - - -print("float add = ",add("float", 1.22, - 2.45, 3.34, 4.45, 5.34)) -print("int add = ", add("int", 1, 2, 3, 4, 5)) - diff --git a/Section5/lecture53/__init__.py b/Section5/lecture53/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section5/lecture54/Program1.py b/Section5/lecture54/Program1.py deleted file mode 100644 index bd09735..0000000 --- a/Section5/lecture54/Program1.py +++ /dev/null @@ -1,9 +0,0 @@ -# Program to show kwargs in Python - -def printer(**kwargs): - for (k,v) in kwargs.items(): - print("key = ",k,", value = ",v) - - -printer(david=32, Paul=21, Adam=43, Sam=31) -printer(david=31) \ No newline at end of file diff --git a/Section5/lecture54/Program2.py b/Section5/lecture54/Program2.py deleted file mode 100644 index 2634745..0000000 --- a/Section5/lecture54/Program2.py +++ /dev/null @@ -1,15 +0,0 @@ -# Program to show both args and kwargs in same function - -def print_function(*args, **kwargs): - print("===== args =====") - for a in args: - print(a) - print("========") - print("=====kwargs=====") - for (k,v) in kwargs.items(): - print("key = ", k,", value = ", v) - - -print_function(1, 2, 3, name="david", age=32, salary=300) - - diff --git a/Section5/lecture54/__init__.py b/Section5/lecture54/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section5/lecture55/Program1.py b/Section5/lecture55/Program1.py deleted file mode 100644 index 7be38d5..0000000 --- a/Section5/lecture55/Program1.py +++ /dev/null @@ -1,11 +0,0 @@ - -# Program to show map() function -list1 = [1, 2, 3, 4, 5] - - -def cube(n): - return n**3 - - -list2 = list(map(cube, list1)) -print("list2 =", list2) \ No newline at end of file diff --git a/Section5/lecture55/Program2.py b/Section5/lecture55/Program2.py deleted file mode 100644 index 93d2a0c..0000000 --- a/Section5/lecture55/Program2.py +++ /dev/null @@ -1,15 +0,0 @@ -# Program to show filter function - -list1 = [21, 54, 62, 35, 67, 34, 55, 57, 35, 45] - - -def checker(n): - if n >= 50: - return True - else: - return False - - -list2 = list(filter(checker, list1)) -print("list2 = ", list2) - diff --git a/Section5/lecture55/Program3.py b/Section5/lecture55/Program3.py deleted file mode 100644 index e237968..0000000 --- a/Section5/lecture55/Program3.py +++ /dev/null @@ -1,13 +0,0 @@ -# Program to show lambda functions - -cube = lambda n: n**3 -print("cube(3) = ", cube(3)) -# using lambda and map -cubes = list(map(lambda n: n**3,[1, 2, 3, 4, 5])) -print("cubes =", cubes) -# using lambda and filter -filtered_list = list(filter(lambda n: n > 10, - [21, 1, 2, 32, 4, 23, 17])) -print("filtered list = ", filtered_list) - - diff --git a/Section5/lecture55/__init__.py b/Section5/lecture55/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section5/main.py b/Section5/main.py deleted file mode 100644 index 5596b44..0000000 --- a/Section5/main.py +++ /dev/null @@ -1,16 +0,0 @@ -# This is a sample Python script. - -# Press Shift+F10 to execute it or replace it with your code. -# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. - - -def print_hi(name): - # Use a breakpoint in the code line below to debug your script. - print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint. - - -# Press the green button in the gutter to run the script. -if __name__ == '__main__': - print_hi('PyCharm') - -# See PyCharm help at https://www.jetbrains.com/help/pycharm/ diff --git a/Section6/.idea/.gitignore b/Section6/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/Section6/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/Section6/.idea/Section6.iml b/Section6/.idea/Section6.iml deleted file mode 100644 index 4c3af76..0000000 --- a/Section6/.idea/Section6.iml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/Section6/.idea/inspectionProfiles/profiles_settings.xml b/Section6/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2d..0000000 --- a/Section6/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/Section6/.idea/misc.xml b/Section6/.idea/misc.xml deleted file mode 100644 index 17b4efa..0000000 --- a/Section6/.idea/misc.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Section6/.idea/modules.xml b/Section6/.idea/modules.xml deleted file mode 100644 index 9204b42..0000000 --- a/Section6/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Section6/.idea/vcs.xml b/Section6/.idea/vcs.xml deleted file mode 100644 index 6c0b863..0000000 --- a/Section6/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Section6/lecture61/Program1.py b/Section6/lecture61/Program1.py deleted file mode 100644 index ee0ccb8..0000000 --- a/Section6/lecture61/Program1.py +++ /dev/null @@ -1,15 +0,0 @@ -# Program to show classes and objects in Python - -class Person: - - def __init__(self,name, age): - self.name = name # instance attribute - self.age = age - - -person1 = Person("David", 31) -print("person 1 name = ", person1.name) -print("person 1 age = ", person1.age) -person2 = Person("Paul",32) -print("person 2 name = ", person2.name) -print("person 2 age = ", person2.age) diff --git a/Section6/lecture61/Program2.py b/Section6/lecture61/Program2.py deleted file mode 100644 index 8c12ac5..0000000 --- a/Section6/lecture61/Program2.py +++ /dev/null @@ -1,18 +0,0 @@ -# Program to show classes and objects in Python - -class Person: - - def run(self): - print("Person running") - - def talk(self): - print("Person talking") - - -person1 = Person() -person1.run() -person1.talk() -print("-------------------------------") -person2 = Person() -person2.run() -person2.talk() diff --git a/Section6/lecture61/Program3.py b/Section6/lecture61/Program3.py deleted file mode 100644 index ac865f7..0000000 --- a/Section6/lecture61/Program3.py +++ /dev/null @@ -1,16 +0,0 @@ -# Program to show class object attributes - - -class Employee: - company = "Udemy" # Class attribute - - def __init__(self, name): - self.name = name # instance attribute - - -obj1 = Employee("David") -print(obj1.name) -print(obj1.company) -print(Employee.company) - - diff --git a/Section6/lecture61/__init__.py b/Section6/lecture61/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section6/lecture62/Program1.py b/Section6/lecture62/Program1.py deleted file mode 100644 index 377df79..0000000 --- a/Section6/lecture62/Program1.py +++ /dev/null @@ -1,13 +0,0 @@ -# Program to show __init__ method - -class Car: - - def __init__(self): - self.name = "Audi" - self.colour = "Red" - - -obj1 = Car() -print(obj1.name) -print(obj1.colour) - diff --git a/Section6/lecture62/Program2.py b/Section6/lecture62/Program2.py deleted file mode 100644 index d579080..0000000 --- a/Section6/lecture62/Program2.py +++ /dev/null @@ -1,22 +0,0 @@ -# Program to show constructors in python - -class Employee: - """ This is an employee class""" - attr1 = "test" # class attribute - - def __init__(self, id, name, department): - print("Constructor called") - self.id = id # instance variables - self.name = name - self.department = department - - -obj1 = Employee(1, "David", "Accounting") -print("Employee details") -print(obj1.id) -print(obj1.name) -print(obj1.department) -print("accessing class attributes "+Employee.attr1) - - - diff --git a/Section6/lecture62/__init__.py b/Section6/lecture62/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section6/lecture63/Program1.py b/Section6/lecture63/Program1.py deleted file mode 100644 index 889ca61..0000000 --- a/Section6/lecture63/Program1.py +++ /dev/null @@ -1,14 +0,0 @@ -# Program to show use of self parameter - -class Student: - - def __init__(self, id, name): - self.id = id - self.name = name - - -obj1 = Student(1, "David") -print("Student details") -print(obj1.id) -print(obj1.name) - diff --git a/Section6/lecture63/Program2.py b/Section6/lecture63/Program2.py deleted file mode 100644 index 423117d..0000000 --- a/Section6/lecture63/Program2.py +++ /dev/null @@ -1,24 +0,0 @@ -# Program to show use of self parameter in methods - -class Student: - - def __init__(self, id, name): - self.id = id - self.name = name - - def getid(self): - return self.id - - def setid(self, id): - self.id = id - - -obj1 = Student(1, "David") -print("Student details") -print(obj1.id) -print(obj1.name) -print("using set and get methods") -obj1.setid(12) -print("id = ", obj1.getid()) - - diff --git a/Section6/lecture63/Program3.py b/Section6/lecture63/Program3.py deleted file mode 100644 index 877fa29..0000000 --- a/Section6/lecture63/Program3.py +++ /dev/null @@ -1,33 +0,0 @@ -# Program to implement a book class and bookstore -class BookStore: - - def __init__(self, books): - self.books = books - - def getbooks(self): - return self.books - - -class Book: - - def __init__(self, name, isbn, author): - self.name = name - self.isbn = isbn - self.author = author - - -bookList = [Book("Book1", "122323-ww-ww", "David"), - Book("Book2", "323332-rr-ee-ee32", "Ben"), - Book("Book3", "223-ew-ee-e", "Paul"), - Book("Book4", "yy-21-12y", "Adam")] -bookstore = BookStore(bookList) -for item in bookstore.getbooks(): - print("==========") - print(item.name) - print(item.isbn) - print(item.author) - print("==========") - - - - diff --git a/Section6/lecture63/__init__.py b/Section6/lecture63/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section6/lecture64/Program1.py b/Section6/lecture64/Program1.py deleted file mode 100644 index 90230fc..0000000 --- a/Section6/lecture64/Program1.py +++ /dev/null @@ -1,23 +0,0 @@ -# Program to show single inherittance - -class Vehicle: - - def __init__(self, number, colour): - self.number = number - self.colour = colour - - -class Car(Vehicle): - pass - - -obj1 = Car(12332, "Red") -print("car details") -print(obj1.number) -print(obj1.colour) - - - - - - diff --git a/Section6/lecture64/Program2.py b/Section6/lecture64/Program2.py deleted file mode 100644 index 34e4771..0000000 --- a/Section6/lecture64/Program2.py +++ /dev/null @@ -1,21 +0,0 @@ -# Program to show method overriding - -class Bird: - - def __init__(self, name): - self.name = name - - def fly(self): - print("Bird flying") - - -class Duck(Bird): - - def fly(self): - print("Duck Cannot fly") - - -obj1 = Duck("Donald") -obj1.fly() - - diff --git a/Section6/lecture64/Program3.py b/Section6/lecture64/Program3.py deleted file mode 100644 index 585ac2b..0000000 --- a/Section6/lecture64/Program3.py +++ /dev/null @@ -1,26 +0,0 @@ -# Program to show multiple inheritance - -class Father: - - def run(self): - print("Father Running") - - -class Mother: - - def run(self): - print("Mother running") - - -class Child1(Father,Mother): - pass - - -class Child2(Mother,Father): - pass - - -obj1 = Child1() -obj1.run() -obj2 = Child2() -obj2.run() diff --git a/Section6/lecture64/Program4.py b/Section6/lecture64/Program4.py deleted file mode 100644 index 3cfe58c..0000000 --- a/Section6/lecture64/Program4.py +++ /dev/null @@ -1,17 +0,0 @@ -# Program showing usage of super keyword - -class Bird: - - def fly(self): - print(" Bird fly()") - - -class Eagle(Bird): - - def fly(self): - super().fly() - print(" Eagle fly()") - - -obj1 = Eagle() -obj1.fly() diff --git a/Section6/lecture64/__init__.py b/Section6/lecture64/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section6/lecture65/Program1.py b/Section6/lecture65/Program1.py deleted file mode 100644 index 76c9c5e..0000000 --- a/Section6/lecture65/Program1.py +++ /dev/null @@ -1,18 +0,0 @@ -# Program to show __str__ and __len__ Dunder methods - -class Student: - - def __init__(self, id, name): - self.id = id - self.name = name - - def __str__(self): - return "Student [id = {}, name = {}]".format(self.id,self.name) - - def __len__(self): - return len(self.name) - - -obj1 = Student(1,"David") -print("str = ", obj1) -print("len = ", len(obj1)) \ No newline at end of file diff --git a/Section6/lecture65/Program2.py b/Section6/lecture65/Program2.py deleted file mode 100644 index 9922163..0000000 --- a/Section6/lecture65/Program2.py +++ /dev/null @@ -1,24 +0,0 @@ -# Program to show __add__ and __new__ Dunder methods - -class Employee: - - def __init__(self, id, name): - print("__init__() callled") - self.id = id - self.name = name - - def __new__(cls, *args, **kwargs): - print("__new__() called") - inst = object.__new__(cls) - return inst - - def __add__(self, other): - return self.id + other.id - - -obj1 = Employee(12,"David") -obj1 = Employee(12, "David") - -obj2 = Employee(2, "Paul") -print("add = ",obj1 + obj2) - diff --git a/Section6/lecture65/Program3.py b/Section6/lecture65/Program3.py deleted file mode 100644 index ef90472..0000000 --- a/Section6/lecture65/Program3.py +++ /dev/null @@ -1,25 +0,0 @@ -# Program to show __eq__ and __del__ dunder methods - -class Person: - - def __init__(self, id): - self.id = id - - def __eq__(self, other): - return self.id == other.id - - def __del__(self): - print("__del__() called") - - -obj1 = Person(12) -obj2 = Person(21) -obj3 = Person(21) - -print(" comparing objects 1 and 2 - ", (obj1 == obj2)) -print(" comparing objects 2 and 3 - ", (obj2 == obj3)) - - - - - diff --git a/Section6/lecture65/__init__.py b/Section6/lecture65/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section6/main.py b/Section6/main.py deleted file mode 100644 index 5596b44..0000000 --- a/Section6/main.py +++ /dev/null @@ -1,16 +0,0 @@ -# This is a sample Python script. - -# Press Shift+F10 to execute it or replace it with your code. -# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. - - -def print_hi(name): - # Use a breakpoint in the code line below to debug your script. - print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint. - - -# Press the green button in the gutter to run the script. -if __name__ == '__main__': - print_hi('PyCharm') - -# See PyCharm help at https://www.jetbrains.com/help/pycharm/ diff --git a/Section7/.idea/.gitignore b/Section7/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/Section7/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/Section7/.idea/Section7.iml b/Section7/.idea/Section7.iml deleted file mode 100644 index b4c17f1..0000000 --- a/Section7/.idea/Section7.iml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/Section7/.idea/inspectionProfiles/profiles_settings.xml b/Section7/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2d..0000000 --- a/Section7/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/Section7/.idea/misc.xml b/Section7/.idea/misc.xml deleted file mode 100644 index 3ecb152..0000000 --- a/Section7/.idea/misc.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Section7/.idea/modules.xml b/Section7/.idea/modules.xml deleted file mode 100644 index 2a7933b..0000000 --- a/Section7/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Section7/.idea/vcs.xml b/Section7/.idea/vcs.xml deleted file mode 100644 index 6c0b863..0000000 --- a/Section7/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Section7/lecture71/Mymodule.py b/Section7/lecture71/Mymodule.py deleted file mode 100644 index 68a8546..0000000 --- a/Section7/lecture71/Mymodule.py +++ /dev/null @@ -1,7 +0,0 @@ -# sample module - -my_var = 20 - - -def my_fun(): - print("From my_fun()") \ No newline at end of file diff --git a/Section7/lecture71/Program1.py b/Section7/lecture71/Program1.py deleted file mode 100644 index 04dcfa6..0000000 --- a/Section7/lecture71/Program1.py +++ /dev/null @@ -1,7 +0,0 @@ -# Program to show use of modules - -from random import randint -print("Random integer = ",randint(1, 10)) - -import random as rand -print("random = ",rand.random()) diff --git a/Section7/lecture71/Program2.py b/Section7/lecture71/Program2.py deleted file mode 100644 index f41fbb1..0000000 --- a/Section7/lecture71/Program2.py +++ /dev/null @@ -1,8 +0,0 @@ -# Program to show custom module in Python - -from Mymodule import my_fun -my_fun() - -from Mymodule import my_var -print("myvar = ", my_var) - diff --git a/Section7/lecture71/__init__.py b/Section7/lecture71/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section7/lecture71/__pycache__/Mymodule.cpython-39.pyc b/Section7/lecture71/__pycache__/Mymodule.cpython-39.pyc deleted file mode 100644 index 22f0063..0000000 Binary files a/Section7/lecture71/__pycache__/Mymodule.cpython-39.pyc and /dev/null differ diff --git a/Section7/lecture71/__pycache__/__init__.cpython-39.pyc b/Section7/lecture71/__pycache__/__init__.cpython-39.pyc deleted file mode 100644 index 4b1b311..0000000 Binary files a/Section7/lecture71/__pycache__/__init__.cpython-39.pyc and /dev/null differ diff --git a/Section7/lecture71/sub/Program3.py b/Section7/lecture71/sub/Program3.py deleted file mode 100644 index 8ff64cb..0000000 --- a/Section7/lecture71/sub/Program3.py +++ /dev/null @@ -1,6 +0,0 @@ -# Program to show import - -from lecture71 import Mymodule -Mymodule.my_fun() -print(Mymodule.my_var) - diff --git a/Section7/lecture71/sub/__init__.py b/Section7/lecture71/sub/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section7/lecture72/File2.txt b/Section7/lecture72/File2.txt deleted file mode 100644 index e69de29..0000000 diff --git a/Section7/lecture72/Hello.txt b/Section7/lecture72/Hello.txt deleted file mode 100644 index fd9b6a6..0000000 --- a/Section7/lecture72/Hello.txt +++ /dev/null @@ -1,3 +0,0 @@ -Hello -My name is David -Welcome to Python diff --git a/Section7/lecture72/MyFile.txt b/Section7/lecture72/MyFile.txt deleted file mode 100644 index be2743b..0000000 --- a/Section7/lecture72/MyFile.txt +++ /dev/null @@ -1 +0,0 @@ -This file is Generated Buy Python \ No newline at end of file diff --git a/Section7/lecture72/Program1.py b/Section7/lecture72/Program1.py deleted file mode 100644 index 2e98b01..0000000 --- a/Section7/lecture72/Program1.py +++ /dev/null @@ -1,6 +0,0 @@ -# Program to read a file using Python - -f = open("Hello.txt", mode="r", encoding='utf-8') -content = f.read() -print(content) -f.close() diff --git a/Section7/lecture72/Program2.py b/Section7/lecture72/Program2.py deleted file mode 100644 index fda9dcd..0000000 --- a/Section7/lecture72/Program2.py +++ /dev/null @@ -1,5 +0,0 @@ -# Program to write a file - -with open("MyFile.txt", mode="w", encoding='utf-8') as f: - f.write("This file is Generated Buy Python") -print("File Written") \ No newline at end of file diff --git a/Section7/lecture72/Program3.py b/Section7/lecture72/Program3.py deleted file mode 100644 index 961f91d..0000000 --- a/Section7/lecture72/Program3.py +++ /dev/null @@ -1,5 +0,0 @@ -# Program to rename a file using os module - -from os import rename -rename("File1.txt", "File2.txt") -print("File renamed") \ No newline at end of file diff --git a/Section7/lecture72/__init__.py b/Section7/lecture72/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section7/lecture73/Program1.py b/Section7/lecture73/Program1.py deleted file mode 100644 index adb2877..0000000 --- a/Section7/lecture73/Program1.py +++ /dev/null @@ -1,9 +0,0 @@ -12# Program to show use of try except block - -try: - n = int(input("Enter a number \n")) - print(" You entered ", n) -except ValueError: - print("That was not an int") - - diff --git a/Section7/lecture73/Program2.py b/Section7/lecture73/Program2.py deleted file mode 100644 index a2542dc..0000000 --- a/Section7/lecture73/Program2.py +++ /dev/null @@ -1,8 +0,0 @@ -# Program to show use of finally block -try: - fop = open("Test.txt", mode="r", encoding="utf-8") - print(fop.read()) -except FileNotFoundError: - print("File was not found") -finally: - print("finally executed") \ No newline at end of file diff --git a/Section7/lecture73/Program3.py b/Section7/lecture73/Program3.py deleted file mode 100644 index 0b5765a..0000000 --- a/Section7/lecture73/Program3.py +++ /dev/null @@ -1,9 +0,0 @@ -# Program to show raising an exception - -n = int(input("Enter numerator \n")) -d = int(input("Enter denominator \n")) -if d == 0: - raise Exception("Denominator is zero") -else: - print("division = ", (n/d)) - diff --git a/Section7/lecture73/Program4.py b/Section7/lecture73/Program4.py deleted file mode 100644 index 3f741a3..0000000 --- a/Section7/lecture73/Program4.py +++ /dev/null @@ -1,11 +0,0 @@ -# Program to create a custom exception - -class ArithmeticException(Exception): - pass - - -try: - raise ArithmeticException("Number is Zero") -except ArithmeticException: - print("Custom Exception Thrown") - diff --git a/Section7/lecture73/Program5.py b/Section7/lecture73/Program5.py deleted file mode 100644 index 7a97401..0000000 --- a/Section7/lecture73/Program5.py +++ /dev/null @@ -1,10 +0,0 @@ -# Program to show Assertions in python - -def print_age(age): - assert(age > 0), "Age must be greater than zero" - print("Age = ", age) - - -print_age(20) -print_age(-1) # Throws Assertion error - diff --git a/Section7/lecture73/__init__.py b/Section7/lecture73/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section7/lecture74/Program1.py b/Section7/lecture74/Program1.py deleted file mode 100644 index c6e2767..0000000 --- a/Section7/lecture74/Program1.py +++ /dev/null @@ -1,10 +0,0 @@ -# Program to show regular expressions in Python - -import re -str = "David" -pattern = r".vid" -match = re.search(pattern, str) -if match: - print("Found") -else: - print("Not Found") diff --git a/Section7/lecture74/Program2.py b/Section7/lecture74/Program2.py deleted file mode 100644 index 8525fea..0000000 --- a/Section7/lecture74/Program2.py +++ /dev/null @@ -1,10 +0,0 @@ -# Program to show regular expressions in Python - -import re -str1 = "David" -pattern = r"[a-z]+" -match = re.search(pattern, str1) -if match: - print("Found") -else: - print("Not Found") diff --git a/Section7/lecture74/Program3.py b/Section7/lecture74/Program3.py deleted file mode 100644 index 29ac612..0000000 --- a/Section7/lecture74/Program3.py +++ /dev/null @@ -1,11 +0,0 @@ -# Program to show regular expressions in Python - -import re -str1 = ":david:,:paul:" -pattern = r":(\w+):+" -find = re.findall(pattern, str1) -if find: - print("Found") - print(find) -else: - print("Not Found") diff --git a/Section7/lecture74/Program4.py b/Section7/lecture74/Program4.py deleted file mode 100644 index 9c983b6..0000000 --- a/Section7/lecture74/Program4.py +++ /dev/null @@ -1,10 +0,0 @@ -# Program to show email validation in Python - -import re -str = "test@test.com" -pattern = r"[\w\.-]+@[\w\.-]+" -match = re.search(pattern, str) -if match: - print("Found") -else: - print("Not Found") diff --git a/Section7/lecture74/__init__.py b/Section7/lecture74/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section7/lecture75/Program1.py b/Section7/lecture75/Program1.py deleted file mode 100644 index 4f0f9fc..0000000 --- a/Section7/lecture75/Program1.py +++ /dev/null @@ -1,9 +0,0 @@ -# Program to show usage of iterator - -tup = ("David", "Adam", "Paul", "Sam") -itr =iter(tup) -while True: - try: - print("item = ", next(itr)) - except StopIteration: - break diff --git a/Section7/lecture75/Program2.py b/Section7/lecture75/Program2.py deleted file mode 100644 index 07a9868..0000000 --- a/Section7/lecture75/Program2.py +++ /dev/null @@ -1,28 +0,0 @@ -# Program to show custom iterators - -class Student: - - def __init__(self, *args): - self.limit = len(args) - self.args = args - - def __iter__(self): - self.pos = 0 - return self - - def __next__(self): - pos = self.pos - if pos >= self.limit: - raise StopIteration - else: - self.pos = pos + 1 - return self.args[pos] - - -obj1 = Student("David", "Paul", "Adam") -itr = iter(obj1) -while True: - try: - print("item = ", next(itr)) - except StopIteration: - break diff --git a/Section7/lecture75/__init__.py b/Section7/lecture75/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section7/lecture76/Program1.py b/Section7/lecture76/Program1.py deleted file mode 100644 index 7620d53..0000000 --- a/Section7/lecture76/Program1.py +++ /dev/null @@ -1,11 +0,0 @@ -# Program to show generators in Python - -def num_gen(limit): - i = 0 - while i < limit: - i = i + 1 - yield i - - -for n in num_gen(5): - print(" n = ", n) diff --git a/Section7/lecture76/Program2.py b/Section7/lecture76/Program2.py deleted file mode 100644 index 4f7d4a7..0000000 --- a/Section7/lecture76/Program2.py +++ /dev/null @@ -1,18 +0,0 @@ -# Program to generate fibonacci series - -def fib(limit): - a, b = 0, 1 - while a < limit: - yield a - a, b = b, a + b - - -obj = fib(6) -print("series:") -print(next(obj)) -print(next(obj)) -print(next(obj)) -print(next(obj)) -print(next(obj)) -print(next(obj)) - diff --git a/Section7/lecture76/Program3.py b/Section7/lecture76/Program3.py deleted file mode 100644 index 01422b3..0000000 --- a/Section7/lecture76/Program3.py +++ /dev/null @@ -1,9 +0,0 @@ -# Program to showgenerator expressions - -gen = (x**2 for x in range(1, 10)) -print(next(gen)) -print(next(gen)) -print(next(gen)) -print(next(gen)) -print(next(gen)) - diff --git a/Section7/lecture76/__init__.py b/Section7/lecture76/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section7/lecture77/Program1.py b/Section7/lecture77/Program1.py deleted file mode 100644 index b1c7c49..0000000 --- a/Section7/lecture77/Program1.py +++ /dev/null @@ -1,19 +0,0 @@ -# Program to show features of python functions - -def fun1(): - print("from fun1") - - -fun2 = fun1 -fun2() - - -def fun3(fun): - fun() - - -fun3(fun2) - - - - diff --git a/Section7/lecture77/Program2.py b/Section7/lecture77/Program2.py deleted file mode 100644 index d8a29b9..0000000 --- a/Section7/lecture77/Program2.py +++ /dev/null @@ -1,18 +0,0 @@ -# Program to show decorators in Python - -def dec_func(original_func): - - def wrap_func(): - print("before call"); - original_func(); - print("After call"); - - return wrap_func; - - -@dec_func -def need_decoration(): - print("inside need decoration"); - - -need_decoration(); \ No newline at end of file diff --git a/Section7/lecture77/__init__.py b/Section7/lecture77/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section7/main.py b/Section7/main.py deleted file mode 100644 index 5596b44..0000000 --- a/Section7/main.py +++ /dev/null @@ -1,16 +0,0 @@ -# This is a sample Python script. - -# Press Shift+F10 to execute it or replace it with your code. -# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. - - -def print_hi(name): - # Use a breakpoint in the code line below to debug your script. - print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint. - - -# Press the green button in the gutter to run the script. -if __name__ == '__main__': - print_hi('PyCharm') - -# See PyCharm help at https://www.jetbrains.com/help/pycharm/ diff --git a/Section8/.idea/.gitignore b/Section8/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/Section8/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/Section8/.idea/Section8.iml b/Section8/.idea/Section8.iml deleted file mode 100644 index 4a6f85e..0000000 --- a/Section8/.idea/Section8.iml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/Section8/.idea/inspectionProfiles/profiles_settings.xml b/Section8/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2d..0000000 --- a/Section8/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/Section8/.idea/misc.xml b/Section8/.idea/misc.xml deleted file mode 100644 index d0fe4ff..0000000 --- a/Section8/.idea/misc.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Section8/.idea/modules.xml b/Section8/.idea/modules.xml deleted file mode 100644 index ee12363..0000000 --- a/Section8/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Section8/.idea/vcs.xml b/Section8/.idea/vcs.xml deleted file mode 100644 index 6c0b863..0000000 --- a/Section8/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Section8/lecture81/Program1.py b/Section8/lecture81/Program1.py deleted file mode 100644 index 5c2b375..0000000 --- a/Section8/lecture81/Program1.py +++ /dev/null @@ -1,10 +0,0 @@ -# Program to show counters in Python - -list1 = ["a", "b", "c", "d", "e", "f"] -from collections import Counter -print("Count of list1 = ", Counter(list1)) - -list2 = [1, 2, 3, 4, 1, 2, 1, 3, 1] -print(" Count of list2 = ",Counter(list2)) - - diff --git a/Section8/lecture81/Program2.py b/Section8/lecture81/Program2.py deleted file mode 100644 index 17a1d3d..0000000 --- a/Section8/lecture81/Program2.py +++ /dev/null @@ -1,14 +0,0 @@ -# Program to show operations on Counter - -from collections import Counter - -c1 = Counter({"a": 2, "b": 3, "c": 5}) -c2 = Counter({"a": 4, "b": 3, "c": 1}) -print("c1 + c2 = ", (c1 + c2)) -print("c2 - c1 = ", (c2 - c1)) -print("c2 and c1 = ", c1 and c2) -print("c2 or c1 = ", c1 or c2) - - - - diff --git a/Section8/lecture81/Program3.py b/Section8/lecture81/Program3.py deleted file mode 100644 index 1ee726c..0000000 --- a/Section8/lecture81/Program3.py +++ /dev/null @@ -1,7 +0,0 @@ -# Program to show counter with strings - -str1 = "i like Apple" - -from collections import Counter -print(Counter(str1)) - diff --git a/Section8/lecture81/__init__.py b/Section8/lecture81/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section8/lecture82/Program1.py b/Section8/lecture82/Program1.py deleted file mode 100644 index a1d64db..0000000 --- a/Section8/lecture82/Program1.py +++ /dev/null @@ -1,27 +0,0 @@ -# Program to show declaration and usage of Named tuple - -from collections import namedtuple - -Employee = namedtuple("Employee", ["id", "name", "department"]) -emp1 = Employee(12, "David", "Management") -print("Employee Details") -print(emp1.id) -print(emp1.name) -print(emp1.department) - - - - - - - - - - - - - - - - -3 \ No newline at end of file diff --git a/Section8/lecture82/Program2.py b/Section8/lecture82/Program2.py deleted file mode 100644 index 8e11a6d..0000000 --- a/Section8/lecture82/Program2.py +++ /dev/null @@ -1,8 +0,0 @@ -# Program to show indexing and getattr() method in Named tuple - -from collections import namedtuple - -Customer = namedtuple("Customer", ["id", "name", "location"]) -cust1 = Customer(21, "David", "India") -print("cust1 name = ", cust1[1]) -print("cust1 location = ", getattr(cust1, "location")) \ No newline at end of file diff --git a/Section8/lecture82/Program3.py b/Section8/lecture82/Program3.py deleted file mode 100644 index 2226dee..0000000 --- a/Section8/lecture82/Program3.py +++ /dev/null @@ -1,11 +0,0 @@ -# Program to show conversion of list and dict to a named tuple -from collections import namedtuple - -list1 = [10, "David", 31] -Student = namedtuple("Student", ["id", "name", "age"]) -stud1 = Student._make(list1) -print("stud1 : ", stud1) -dict1 = {"id": 43, "name": "Paul", "age": 43} -stud2 = Student(**dict1) -print("stud2 : ", stud2) - diff --git a/Section8/lecture82/Program4.py b/Section8/lecture82/Program4.py deleted file mode 100644 index 5d4acf6..0000000 --- a/Section8/lecture82/Program4.py +++ /dev/null @@ -1,8 +0,0 @@ -# Program to show named tuples with default values - -from collections import namedtuple -Person = namedtuple("Person", - ["name","age","height"], - defaults=["David", 31, 180]) -p1 = Person() -print("p1 = ", p1) diff --git a/Section8/lecture82/__init__.py b/Section8/lecture82/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section8/lecture83/Program1.py b/Section8/lecture83/Program1.py deleted file mode 100644 index ec9dce5..0000000 --- a/Section8/lecture83/Program1.py +++ /dev/null @@ -1,8 +0,0 @@ -# Program to show declaration and usage of OrderedDict - -from collections import OrderedDict -dict1 = OrderedDict() -dict1["name"] = "David" -dict1["age"] = 31 -dict1["branch"] = "CS" -print(dict1) diff --git a/Section8/lecture83/Program2.py b/Section8/lecture83/Program2.py deleted file mode 100644 index fe3972c..0000000 --- a/Section8/lecture83/Program2.py +++ /dev/null @@ -1,13 +0,0 @@ -# Program to show methods of orderedDict - -from collections import OrderedDict -emp_dict = OrderedDict() -emp_dict["name"] = "David" -emp_dict["id"] = 12 -emp_dict["department"] = "Accounting" -print("emp_dict details : ",emp_dict) -emp_dict.update({"location": "India"}) -print("emp_dict details after update: ", emp_dict) -emp_dict.move_to_end("name", last=True) -print("emp_dict after move_to_end : ", emp_dict) - diff --git a/Section8/lecture83/__init__.py b/Section8/lecture83/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section8/lecture84/Program1.py b/Section8/lecture84/Program1.py deleted file mode 100644 index bab18f2..0000000 --- a/Section8/lecture84/Program1.py +++ /dev/null @@ -1,8 +0,0 @@ -# Program to show advanced list methods - -list1 = [3, 2, 1, 4, 6, 5, 7, 8, 9] -print("count(2) = ", list1.count(2)) -list1.sort() -print("after sort = ", list1) -list1.extend([10, 11, 12, 13, 14]) -print("After extend = ", list1) \ No newline at end of file diff --git a/Section8/lecture84/Program2.py b/Section8/lecture84/Program2.py deleted file mode 100644 index f544eb7..0000000 --- a/Section8/lecture84/Program2.py +++ /dev/null @@ -1,5 +0,0 @@ -# Program to show advanced Tuple methods - -tup1 = (1, 2, 3, 4, 5, 6, 7, 8, 9) -print("count(1) = ", tup1.count(1)) -print("index(3) = ", tup1.index(3)) \ No newline at end of file diff --git a/Section8/lecture84/Program3.py b/Section8/lecture84/Program3.py deleted file mode 100644 index 1d9720b..0000000 --- a/Section8/lecture84/Program3.py +++ /dev/null @@ -1,8 +0,0 @@ -# Program to show advanced set methods - -set1 = {1, 2, 3, 4, 5, 6} -set2 = { 4, 5, 6, 7, 8, 9} -print("difference() = ",set1.difference(set2)) -print("symmetric_difference() = ", - set1.symmetric_difference(set2)) -print("isdisjoint", set1.isdisjoint({10, 11, 23})) \ No newline at end of file diff --git a/Section8/lecture84/Program4.py b/Section8/lecture84/Program4.py deleted file mode 100644 index 6033788..0000000 --- a/Section8/lecture84/Program4.py +++ /dev/null @@ -1,8 +0,0 @@ -# Program to show advanced methods in Dictionaries - -user_dict = {"name": "David", "age": 31} -user_dict.setdefault("id", 0) -print("after set default : ", user_dict) -print("copy : ",user_dict.copy()) -print("from keys = ",user_dict. - fromkeys([1, 2, 3, 4, 5],0)) diff --git a/Section8/lecture84/__init__.py b/Section8/lecture84/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section8/lecture85/Program1.py b/Section8/lecture85/Program1.py deleted file mode 100644 index f96cb2c..0000000 --- a/Section8/lecture85/Program1.py +++ /dev/null @@ -1,6 +0,0 @@ -# Program to show datetime in Python -import datetime -print("Current date and time = ",datetime.datetime.now()) -print("Current date = ", datetime.date.today()) -print("Current time = ",datetime.datetime.now().time()) - diff --git a/Section8/lecture85/Program2.py b/Section8/lecture85/Program2.py deleted file mode 100644 index 15fb01a..0000000 --- a/Section8/lecture85/Program2.py +++ /dev/null @@ -1,7 +0,0 @@ -# Program to create custom date object -from datetime import date -a = date(2022, 4, 13) -print(a) -# from time stamp -timestamp = date.fromtimestamp(1426944364) -print("fromtimestamp() = ", timestamp) diff --git a/Section8/lecture85/Program3.py b/Section8/lecture85/Program3.py deleted file mode 100644 index b6ad98b..0000000 --- a/Section8/lecture85/Program3.py +++ /dev/null @@ -1,6 +0,0 @@ -# Program to show timedelta -from datetime import timedelta -t1 = timedelta(minutes=1 , seconds=10) -t2 = timedelta(minutes=1 , seconds=50) -print("adding times = ",t1 + t2) -print("subtracting times = ",t2 - t1) \ No newline at end of file diff --git a/Section8/lecture85/Program4.py b/Section8/lecture85/Program4.py deleted file mode 100644 index f223f1e..0000000 --- a/Section8/lecture85/Program4.py +++ /dev/null @@ -1,12 +0,0 @@ -# Program to show formatting of date time -from datetime import datetime - -now = datetime.now() -t = now.strftime("%H:%M:%S") -print("time:", t) -str1 = now.strftime("%m/%d/%Y, %H:%M:%S") -# mm/dd/YY H:M:S format -print("str1:", str1) -str2 = now.strftime("%d/%m/%Y, %H:%M:%S") -# dd/mm/YY H:M:S format -print("str2:", str2) \ No newline at end of file diff --git a/Section8/lecture85/__init__.py b/Section8/lecture85/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section8/lecture86/Program1.py b/Section8/lecture86/Program1.py deleted file mode 100644 index 2093ef6..0000000 --- a/Section8/lecture86/Program1.py +++ /dev/null @@ -1,9 +0,0 @@ -# Program to show constants in math module - -import math -print("Pi = ", math.pi) -print("Tau = ", math.tau) -print("e = ", math.e) -print("infinity = ", math.inf) -print("nan = ", math.nan) - diff --git a/Section8/lecture86/Program2.py b/Section8/lecture86/Program2.py deleted file mode 100644 index 28df1b6..0000000 --- a/Section8/lecture86/Program2.py +++ /dev/null @@ -1,8 +0,0 @@ -# Program to show math module methods - -import math -print("floor() = ", math.floor(3.92)) -print("ciel() = ", math.ceil(3.92)) -print("exp() = ", math.exp(10)) -print("pow() = ", math.pow(10,2)) -print("degrees() = ",math.degrees(1)) \ No newline at end of file diff --git a/Section8/lecture86/Program3.py b/Section8/lecture86/Program3.py deleted file mode 100644 index 2f9960b..0000000 --- a/Section8/lecture86/Program3.py +++ /dev/null @@ -1,15 +0,0 @@ -# Program to show trignometric methods - - -import math - -var1 = 2 -print("sin(0) =", math.sin(0)) -print("cos(0) =", math.cos(0)) -print("tan(0) =", math.tan(0)) -print("atan(1) =", math.atan(1)) - - - - - diff --git a/Section8/lecture86/__init__.py b/Section8/lecture86/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Section8/main.py b/Section8/main.py deleted file mode 100644 index 5596b44..0000000 --- a/Section8/main.py +++ /dev/null @@ -1,16 +0,0 @@ -# This is a sample Python script. - -# Press Shift+F10 to execute it or replace it with your code. -# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. - - -def print_hi(name): - # Use a breakpoint in the code line below to debug your script. - print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint. - - -# Press the green button in the gutter to run the script. -if __name__ == '__main__': - print_hi('PyCharm') - -# See PyCharm help at https://www.jetbrains.com/help/pycharm/