From 999c6199d085a0c7fa37245eaa3762fbd35cb419 Mon Sep 17 00:00:00 2001 From: Nimrod Date: Tue, 30 Jul 2024 13:25:16 +0300 Subject: [PATCH 1/3] add-empty-file --- python/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 python/__init__.py diff --git a/python/__init__.py b/python/__init__.py new file mode 100644 index 0000000..e69de29 From 5a85250bb3b6a2a38fe4d5137319134bfb839983 Mon Sep 17 00:00:00 2001 From: Nimrod Date: Tue, 30 Jul 2024 13:41:32 +0300 Subject: [PATCH 2/3] delete-empty-file --- python/__init__.py | 0 python2/additions.py | 101 +++++++++++++++++++++++++++++++++++++++ python2/dir/deletions.py | 72 ++++++++++++++++++++++++++++ python2/edits.py | 77 +++++++++++++++++++++++++++++ python2/new.py | 1 + 5 files changed, 251 insertions(+) delete mode 100644 python/__init__.py create mode 100644 python2/additions.py create mode 100644 python2/dir/deletions.py create mode 100644 python2/edits.py create mode 100644 python2/new.py diff --git a/python/__init__.py b/python/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/python2/additions.py b/python2/additions.py new file mode 100644 index 0000000..095d5e7 --- /dev/null +++ b/python2/additions.py @@ -0,0 +1,101 @@ +# Solve the quadratic equation ax**2 + bx + c = 0 + +# import complex math module +import cmath + +a = 1 +b = 5 +c = 6 + +# calculate the discriminant +d = (b**2) - (4*a*c) + +# find two solutions +sol1 = (-b-cmath.sqrt(d))/(2*a) +sol2 = (-b+cmath.sqrt(d))/(2*a) + +print('The solution are {0} and {1}'.format(sol1, sol2)) + +rows = int(input("Enter number of rows: ")) + +for i in range(rows): + for j in range(i+1): + print("* ", end="") + print("\n") + +# Taking kilometers input from the user +kilometers = float(input("Enter value in kilometers: ")) + +# conversion factor +conv_fac = 0.621371 + +# calculate miles +miles = kilometers * conv_fac +print('%0.2f kilometers is equal to %0.2f miles' %(kilometers,miles)) +printlnt("All done!") + + + +# Program to add two matrices using nested loop + +X = [[12,7,3], + [4 ,5,6], + [7 ,8,9]] + +Y = [[5,8,1], + [6,7,3], + [4,5,9]] + +result = [[0,0,0], + [0,0,0], + [0,0,0]] + +# iterate through rows +for i in range(len(X)): + # iterate through columns + for j in range(len(X[0])): + result[i][j] = X[i][j] + Y[i][j] + +for r in result: + print(r) + + +def file_len(fname): + with open(fname) as f: + for i, l in enumerate(f): + pass + return i + 1 + + +print(file_len("my_file.txt")) + +count = 0 + +my_string = "Programiz" +my_char = "r" + +for i in my_string: + if i == my_char: + count += 1 + +print(count) + + +# Program to sort alphabetically the words form a string provided by the user + +my_str = "Hello this Is an Example With cased letters" + +# To take input from the user +#my_str = input("Enter a string: ") + +# breakdown the string into a list of words +words = [word.lower() for word in my_str.split()] + +# sort the list +words.sort() + +# display the sorted words + +print("The sorted words are:") +for word in words: + print(word) diff --git a/python2/dir/deletions.py b/python2/dir/deletions.py new file mode 100644 index 0000000..028ab6f --- /dev/null +++ b/python2/dir/deletions.py @@ -0,0 +1,72 @@ +# Solve the quadratic equation ax**2 + bx + c = 0 + +# import complex math module +import cmath + +a = 1 +b = 5 +c = 6 + +# calculate the discriminant +d = (b**2) - (4*a*c) + +# find two solutions +sol1 = (-b-cmath.sqrt(d))/(2*a) +sol2 = (-b+cmath.sqrt(d))/(2*a) + +print('The solution are {0} and {1}'.format(sol1, sol2)) + +# Taking kilometers input from the user +kilometers = float(input("Enter value in kilometers: ")) + +# conversion factor +conv_fac = 0.621371 + +# calculate miles +miles = kilometers * conv_fac +print('%0.2f kilometers is equal to %0.2f miles' %(kilometers,miles)) + + +# Program to add two matrices using nested loop + +X = [[12,7,3], + [4 ,5,6], + [7 ,8,9]] + +Y = [[5,8,1], + [6,7,3], + [4,5,9]] + +result = [[0,0,0], + [0,0,0], + [0,0,0]] + +# iterate through rows +for i in range(len(X)): + # iterate through columns + for j in range(len(X[0])): + result[i][j] = X[i][j] + Y[i][j] + +for r in result: + print(r) + + +def file_len(fname): + with open(fname) as f: + for i, l in enumerate(f): + pass + return i + 1 + + +print(file_len("my_file.txt")) + +count = 0 + +my_string = "Programiz" +my_char = "r" + +for i in my_string: + if i == my_char: + count += 1 + +print(count) diff --git a/python2/edits.py b/python2/edits.py new file mode 100644 index 0000000..51b4b89 --- /dev/null +++ b/python2/edits.py @@ -0,0 +1,77 @@ +# All the code below was taken from https://www.programiz.com/python-programming/examples + +# Solve the quadratic equation ax**2 + bx + c = 0 + +# import complex math module +import cmath + +a = 1 +a += 3 +b2 = 5 +b2 *= 2 +c = 4 + +c += 3 + +# calculate the discriminant +d = (b2 ** 2) - (4 * a * c) + +# find two solutions +sol1 = (-b2 - cmath.sqrt(d)) / (2 * a) +sol2 = (-b2 + cmath.sqrt(d)) / (2 * a) + +print('The solution are {0} and {1}'.format(sol1, sol2)) + +# Taking kilometers input from the user +kilometers = float(input("Enter value in kilometers: ")) + +# conversion factor +conv_fac = 0.621371 + +# calculate miles +miles = kilometers * conv_fac +print('%0.2f kilometers is equal to %0.2f miles' % (kilometers, miles)) + +# Program to add two matrices using nested loop + +X = [[12, 7, 3], + [4, 5, 6], + [7, 8, 9]] + +Y = [[5, 8, 1], + [6, 7, 3], + [4, 5, 9]] + +result = [[0, 0, 0], + [0, 0, 0], + [0, 0, 0]] + +# iterate through rows +for i in range(len(X)): + # iterate through columns + for j in range(len(X[0])): + result[i][j] = X[i][j] + Y[i][j] + +for r in result: + print(r) + + +def file_len(file_name, status): + with open(file_name, status) as f: + for i, l in enumerate(f): + pass + return i + 1 + + +print(file_len("my_file.txt", "r")) + +count = 0 + +my_string = "Programiz" +my_char = "r" + +for i in my_string: + if i == my_char: + count += 1 + +print(count) diff --git a/python2/new.py b/python2/new.py new file mode 100644 index 0000000..73b24ac --- /dev/null +++ b/python2/new.py @@ -0,0 +1 @@ +print("new file") \ No newline at end of file From 0b63797fe270da3d33d453488386917c9a93f346 Mon Sep 17 00:00:00 2001 From: Nimrod Date: Tue, 30 Jul 2024 13:42:05 +0300 Subject: [PATCH 3/3] remove-garbage --- python2/additions.py | 101 --------------------------------------- python2/dir/deletions.py | 72 ---------------------------- python2/edits.py | 77 ----------------------------- python2/new.py | 1 - 4 files changed, 251 deletions(-) delete mode 100644 python2/additions.py delete mode 100644 python2/dir/deletions.py delete mode 100644 python2/edits.py delete mode 100644 python2/new.py diff --git a/python2/additions.py b/python2/additions.py deleted file mode 100644 index 095d5e7..0000000 --- a/python2/additions.py +++ /dev/null @@ -1,101 +0,0 @@ -# Solve the quadratic equation ax**2 + bx + c = 0 - -# import complex math module -import cmath - -a = 1 -b = 5 -c = 6 - -# calculate the discriminant -d = (b**2) - (4*a*c) - -# find two solutions -sol1 = (-b-cmath.sqrt(d))/(2*a) -sol2 = (-b+cmath.sqrt(d))/(2*a) - -print('The solution are {0} and {1}'.format(sol1, sol2)) - -rows = int(input("Enter number of rows: ")) - -for i in range(rows): - for j in range(i+1): - print("* ", end="") - print("\n") - -# Taking kilometers input from the user -kilometers = float(input("Enter value in kilometers: ")) - -# conversion factor -conv_fac = 0.621371 - -# calculate miles -miles = kilometers * conv_fac -print('%0.2f kilometers is equal to %0.2f miles' %(kilometers,miles)) -printlnt("All done!") - - - -# Program to add two matrices using nested loop - -X = [[12,7,3], - [4 ,5,6], - [7 ,8,9]] - -Y = [[5,8,1], - [6,7,3], - [4,5,9]] - -result = [[0,0,0], - [0,0,0], - [0,0,0]] - -# iterate through rows -for i in range(len(X)): - # iterate through columns - for j in range(len(X[0])): - result[i][j] = X[i][j] + Y[i][j] - -for r in result: - print(r) - - -def file_len(fname): - with open(fname) as f: - for i, l in enumerate(f): - pass - return i + 1 - - -print(file_len("my_file.txt")) - -count = 0 - -my_string = "Programiz" -my_char = "r" - -for i in my_string: - if i == my_char: - count += 1 - -print(count) - - -# Program to sort alphabetically the words form a string provided by the user - -my_str = "Hello this Is an Example With cased letters" - -# To take input from the user -#my_str = input("Enter a string: ") - -# breakdown the string into a list of words -words = [word.lower() for word in my_str.split()] - -# sort the list -words.sort() - -# display the sorted words - -print("The sorted words are:") -for word in words: - print(word) diff --git a/python2/dir/deletions.py b/python2/dir/deletions.py deleted file mode 100644 index 028ab6f..0000000 --- a/python2/dir/deletions.py +++ /dev/null @@ -1,72 +0,0 @@ -# Solve the quadratic equation ax**2 + bx + c = 0 - -# import complex math module -import cmath - -a = 1 -b = 5 -c = 6 - -# calculate the discriminant -d = (b**2) - (4*a*c) - -# find two solutions -sol1 = (-b-cmath.sqrt(d))/(2*a) -sol2 = (-b+cmath.sqrt(d))/(2*a) - -print('The solution are {0} and {1}'.format(sol1, sol2)) - -# Taking kilometers input from the user -kilometers = float(input("Enter value in kilometers: ")) - -# conversion factor -conv_fac = 0.621371 - -# calculate miles -miles = kilometers * conv_fac -print('%0.2f kilometers is equal to %0.2f miles' %(kilometers,miles)) - - -# Program to add two matrices using nested loop - -X = [[12,7,3], - [4 ,5,6], - [7 ,8,9]] - -Y = [[5,8,1], - [6,7,3], - [4,5,9]] - -result = [[0,0,0], - [0,0,0], - [0,0,0]] - -# iterate through rows -for i in range(len(X)): - # iterate through columns - for j in range(len(X[0])): - result[i][j] = X[i][j] + Y[i][j] - -for r in result: - print(r) - - -def file_len(fname): - with open(fname) as f: - for i, l in enumerate(f): - pass - return i + 1 - - -print(file_len("my_file.txt")) - -count = 0 - -my_string = "Programiz" -my_char = "r" - -for i in my_string: - if i == my_char: - count += 1 - -print(count) diff --git a/python2/edits.py b/python2/edits.py deleted file mode 100644 index 51b4b89..0000000 --- a/python2/edits.py +++ /dev/null @@ -1,77 +0,0 @@ -# All the code below was taken from https://www.programiz.com/python-programming/examples - -# Solve the quadratic equation ax**2 + bx + c = 0 - -# import complex math module -import cmath - -a = 1 -a += 3 -b2 = 5 -b2 *= 2 -c = 4 - -c += 3 - -# calculate the discriminant -d = (b2 ** 2) - (4 * a * c) - -# find two solutions -sol1 = (-b2 - cmath.sqrt(d)) / (2 * a) -sol2 = (-b2 + cmath.sqrt(d)) / (2 * a) - -print('The solution are {0} and {1}'.format(sol1, sol2)) - -# Taking kilometers input from the user -kilometers = float(input("Enter value in kilometers: ")) - -# conversion factor -conv_fac = 0.621371 - -# calculate miles -miles = kilometers * conv_fac -print('%0.2f kilometers is equal to %0.2f miles' % (kilometers, miles)) - -# Program to add two matrices using nested loop - -X = [[12, 7, 3], - [4, 5, 6], - [7, 8, 9]] - -Y = [[5, 8, 1], - [6, 7, 3], - [4, 5, 9]] - -result = [[0, 0, 0], - [0, 0, 0], - [0, 0, 0]] - -# iterate through rows -for i in range(len(X)): - # iterate through columns - for j in range(len(X[0])): - result[i][j] = X[i][j] + Y[i][j] - -for r in result: - print(r) - - -def file_len(file_name, status): - with open(file_name, status) as f: - for i, l in enumerate(f): - pass - return i + 1 - - -print(file_len("my_file.txt", "r")) - -count = 0 - -my_string = "Programiz" -my_char = "r" - -for i in my_string: - if i == my_char: - count += 1 - -print(count) diff --git a/python2/new.py b/python2/new.py deleted file mode 100644 index 73b24ac..0000000 --- a/python2/new.py +++ /dev/null @@ -1 +0,0 @@ -print("new file") \ No newline at end of file