diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2d..0000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index d25410e..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 98d144a..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/python-programs.iml b/.idea/python-programs.iml deleted file mode 100644 index 66b1709..0000000 --- a/.idea/python-programs.iml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/If.....Elif......Else.py b/If.....Elif......Else.py deleted file mode 100644 index 646475d..0000000 --- a/If.....Elif......Else.py +++ /dev/null @@ -1,41 +0,0 @@ -# TO Display A Numeric Digit In Words -x=int(input('Enter A Digit:')) -if x==0: - print("Zero") -elif x==1: - print("One") -elif x==2: - print("Two") -elif x==3: - print("Three") -elif x==4: - print("Fourth") -elif x==5: - print("Fifth") -elif x==6: - print("Sixth") -elif x==7: - print("Seventh") -elif x==8: - Print("Eight") -elif x==9: - Print("Nineth")#else part not compulsory - - - - - - - - - - - -#To Know If A Given Number is Zero Or +Ve Or -Ve -num=-1 -if num==0: - print(num, "is zero") -elif num>0: - print(num, "is positive") -else: - print(num, "negative") diff --git a/Natural Numbers.py b/Natural Numbers.py deleted file mode 100644 index 6742434..0000000 --- a/Natural Numbers.py +++ /dev/null @@ -1,14 +0,0 @@ -# sum of natural numbers up to num -num = 25 - -if num < 0: - print("enter the positive number") -else: - sum = 0 - # use while loop to iterate until zero - while(num > 0): - print("Current num value is {0} & sum value is {1}: ".format(num, sum)) - sum += num - num -= 1 - print("The sum is",sum) - \ No newline at end of file diff --git a/Simple Calculator.py b/Simple Calculator.py deleted file mode 100644 index aba992e..0000000 --- a/Simple Calculator.py +++ /dev/null @@ -1,47 +0,0 @@ -# Python Make a simple calculator - -# This function add two number -def add(x,y): - return x+y - -# This function Subtract two number -def Subtract(x,y): - return x-y - -# This function Multiply two number -def Multiply(x,y): - return x*y - -# This function Divide two number -def Divide(x,y): - return x/y -print("Select operation.") -print("1.Add") -print("2.Subtract") -print("3.Multiply") -print("4.Divide") - -while True: - # Take input from the user - choice = input("Enter choice(1/2/3/4): ") - # Check if choice is one of the four options - if choice in ('1', '2', '3', '4'): - - - num1 = float(input("Enter first number: ")) - num2 = float(input("Enter second number: ")) - - if choice == '1': - print(num1, "+", num2, "=", add(num1, num2)) - - elif choice == '2': - print(num1, "-", num2, "=", subtract(num1, num2)) - - elif choice == '3': - print(num1, "*", num2, "=", multiply(num1, num2)) - - elif choice == '4': - print(num1, "/", num2, "=", divide(num1, num2)) - break - else: - print("Invalid Input") \ No newline at end of file diff --git a/Tuple.py b/Tuple.py deleted file mode 100644 index 5fe7c5a..0000000 --- a/Tuple.py +++ /dev/null @@ -1,7 +0,0 @@ -# 8-1-22 -# Tuple - -a = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) -print(a[1:8]) -print(a[1:]) -print(a[:5]) diff --git a/Tuple1.py b/Tuple1.py deleted file mode 100644 index d4e43e7..0000000 --- a/Tuple1.py +++ /dev/null @@ -1,14 +0,0 @@ -# 9-1-23 -# tuple program -# Tuple with integer types -a = (30, 10, 20) -# Tuple with string types -b = ("Suresh", "Rohini", "Trisha", "Hashish") -# Tuple with mix types -c = (10, "Never Give up", 20) -# Empty Tuple -d = () -print("a = ", a) -print("b = ", b) -print("c = ", c) -print("d = ", d) diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..fc24e7a --- /dev/null +++ b/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-hacker \ No newline at end of file diff --git a/add two number.py b/add two number.py deleted file mode 100644 index 0c1deae..0000000 --- a/add two number.py +++ /dev/null @@ -1,9 +0,0 @@ -# This program adds two numbers -num1 = 2.5 -num2 = 7.9 - -# add two numbers -sum = num1+num2 - -# Display the sum -print('The sum of {0} and {1} is {2}'.format(num1,num2,sum)) \ No newline at end of file diff --git a/add_two_numbers.py b/add_two_numbers.py deleted file mode 100644 index 2dd4025..0000000 --- a/add_two_numbers.py +++ /dev/null @@ -1,28 +0,0 @@ -#addition -a=50 -b=50 -c=a+b -print("sum is:",c) - -#subtraction -a=50 -b=50 -c=a-b -print("sum is:",c) - -#multiplication -a=50 -b=50 -c=a*b -print("sum is:",c) - -#division -a=50 -b=50 -c=a/b -print("sum is:",c) -#module -a=50 -b=40 -c=a%b -print("sum is:",c) diff --git a/all_negative_integers_of_a_range.py b/all_negative_integers_of_a_range.py deleted file mode 100644 index e74ede1..0000000 --- a/all_negative_integers_of_a_range.py +++ /dev/null @@ -1,12 +0,0 @@ -# 23=7-22 -# print all negative integers of a range -start = int(input("enter the starting range: ")) -end = int(input("enter the ending range: ")) -# iterating the number -for num in range(start,end+1): - - # if checking condition - if num < 0: - print(num, end=" ") - - diff --git a/all_positive_integers_in_a_range.py b/all_positive_integers_in_a_range.py deleted file mode 100644 index a42ebcf..0000000 --- a/all_positive_integers_in_a_range.py +++ /dev/null @@ -1,11 +0,0 @@ -# 21-7-22 -# to print all positive integers in a range -# input string -start = int(input("enter a starting range: ")) -end = int(input("enter a ending range: ")) -# iterating each number -for num in range(start,end+1): - - # checking condition - if num >= 0: - print(num, end=" ") diff --git a/area_of_triangle.py b/area_of_triangle.py deleted file mode 100644 index 1207d5f..0000000 --- a/area_of_triangle.py +++ /dev/null @@ -1,18 +0,0 @@ -j=9 -s=6 -y=4 -b=7 -r=2 -#uncomment below to take inputs from the user -#j=float(input('enter first side:')) -#s=float(input('enter second side:')) -#j=float(input('enter third side:')) -#j=float(input('enter fourth side:')) -#j=float(input('enter fifth side:')) - -#calculate the semi-perimeter -s=(j+s+y+b+r) / 2 - -#calculate the area -area=(s*(s-j)*(s-s)*(s-y)*(s-b)*(s-r)) ** 0.5 -print('the area of the triangle is %0.2f' %area) diff --git a/binary.py b/binary.py deleted file mode 100644 index b02822a..0000000 --- a/binary.py +++ /dev/null @@ -1,60 +0,0 @@ -# 31-12-22 -# binary search in delete operation -# Definition: Binary tree node. -class TreeNode(object): - def __init__(self, x): - self.val = x - self.left = None - self.right = None - - -def delete_Node(root, key): - # if root doesn't exist, just return it - if not root: - return root - # Find the node in the left subtree if key value is less than root value - if root.val > key: - root.left = delete_Node(root.left, key) - # Find the node in right subtree if key value is greater than root value, - elif root.val < key: - root.right = delete_Node(root.right, key) - # Delete the node if root.value == key - else: - # If there is no right children delete the node and new root would be root.left - if not root.right: - return root.left - # If there is no left children delete the node and new root would be root.right - if not root.left: - return root.right - # If both left and right children exist in the node replace its value with - # the minmimum value in the right subtree. Now delete that minimum node - # in the right subtree - temp_val = root.right - mini_val = temp_val.val - while temp_val.left: - temp_val = temp_val.left - mini_val = temp_val.val - # Delete the minimum node in right subtree - root.right = deleteNode(root.right, root.val) - return root - - -def preOrder(node): - if not node: - return - print(node.val) - preOrder(node.left) - preOrder(node.right) - - -root = TreeNode(5) -root.left = TreeNode(3) -root.right = TreeNode(6) -root.left.left = TreeNode(2) -root.left.right = TreeNode(4) -root.left.right.left = TreeNode(7) -print("Original node:") -print(preOrder(root)) -result = delete_Node(root, 4) -print("After deleting specified node:") -print(preOrder(result)) diff --git a/binary_Tree.py b/binary_Tree.py deleted file mode 100644 index 06d4335..0000000 --- a/binary_Tree.py +++ /dev/null @@ -1,39 +0,0 @@ -# 28-12-22 -# binary tree -class Node: - def __init__(self, data): - self.left = None - self.right = None - self.data = data - - def insert(self, data): -# Compare the new value with the parent node - if self.data: - if data < self.data: - if self.left is None: - self.left = Node(data) - else: - self.left.insert(data) - else: - data > self.data - if self.right is None: - self.right = Node(data) - else: - self.right.insert(data) - else: - self.data = data - -# Print the tree - def PrintTree(self): - if self.left: - self.left.PrintTree() - print( self.data), - if self.right: - self.right.PrintTree() - -# Use the insert method to add nodes -root = Node(12) -root.insert(6) -root.insert(14) -root.insert(3) -root.PrintTree() diff --git a/binary_numbers_using_queue.py b/binary_numbers_using_queue.py deleted file mode 100644 index 826b32b..0000000 --- a/binary_numbers_using_queue.py +++ /dev/null @@ -1,43 +0,0 @@ -# 23-8-22 -# binary numbers using queue - -from collections import deque - -class Queue: - def __init__(self): - self.buffer = deque() - - def enqueue(self, val): - self.buffer.appendleft(val) - - def dequeue(self): - if len(self.buffer)==0: - print("Queue is empty") - return - - return self.buffer.pop() - - def is_empty(self): - return len(self.buffer) == 0 - - def size(self): - return len(self.buffer) - - def front(self): - return self.buffer[-1] - -def produce_binary_numbers(n): - numbers_queue = Queue() - numbers_queue.enqueue("1") - - for i in range(n): - front = numbers_queue.front() - print(" ", front) - numbers_queue.enqueue(front + "0") - numbers_queue.enqueue(front + "1") - - numbers_queue.dequeue() - - -if __name__ == '__main__': - produce_binary_numbers(10) diff --git a/binary_search.py b/binary_search.py deleted file mode 100644 index f8ff1a8..0000000 --- a/binary_search.py +++ /dev/null @@ -1,45 +0,0 @@ -# 12-12-22 -# binary search -# Python3 Program for recursive binary search. - -# Returns index of x in arr if present, else -1 - - -def binarySearch(arr, l, r, x): - - # Check base case - if r >= l: - - mid = l + (r - l) // 2 - - # If element is present at the middle itself - if arr[mid] == x: - return mid - - # If element is smaller than mid, then it - # can only be present in left subarray - elif arr[mid] > x: - return binarySearch(arr, l, mid-1, x) - - # Else the element can only be present - # in right subarray - else: - return binarySearch(arr, mid + 1, r, x) - - else: - # Element is not present in the array - return -1 - - -# Driver Code -arr = [10,15,20 ,25, 30 ,35,40 ,45,50 ,55,60 ,65,70,75,80,85,90,95,100] -x = 100 - -# Function call -result = binarySearch(arr, 0, len(arr)-1, x) - -if result != -1: - print("Element is present at index % d" % result) -else: - print("Element is not present in array") - diff --git a/binary_search_.py b/binary_search_.py deleted file mode 100644 index 32f64f4..0000000 --- a/binary_search_.py +++ /dev/null @@ -1 +0,0 @@ -t \ No newline at end of file diff --git a/binary_search_tree.py b/binary_search_tree.py deleted file mode 100644 index 6db2a3c..0000000 --- a/binary_search_tree.py +++ /dev/null @@ -1,53 +0,0 @@ -# 30-12-22 -# binary search tree - -class Node: - def __init__(self, key): - self.left = None - self.right = None - self.val = key - - -# A utility function to insert -# a new node with the given key -def insert(root, key): - if root is None: - return Node(key) - else: - if root.val == key: - return root - elif root.val < key: - root.right = insert(root.right, key) - else: - root.left = insert(root.left, key) - return root - - -# A utility function to do inorder tree traversal -def inorder(root): - if root: - inorder(root.left) - print(root.val, end =" ") - inorder(root.right) - - -# Driver program to test the above functions -if __name__ == '__main__': - - # Let us create the following BST - # 50 - # / \ - # 30 70 - # / \ / \ - # 20 40 60 80 - - r = Node(50) - r = insert(r, 30) - r = insert(r, 20) - r = insert(r, 40) - r = insert(r, 70) - r = insert(r, 60) - r = insert(r, 80) - - # Print inoder traversal of the BST - inorder(r) diff --git a/binary_search_tree_example.py b/binary_search_tree_example.py deleted file mode 100644 index 0bd8728..0000000 --- a/binary_search_tree_example.py +++ /dev/null @@ -1,80 +0,0 @@ -# 30-12-22 -# binary search tree -class BinaryTreeNode: - def __init__(self, data): - self.data = data - self.leftChild = None - self.rightChild = None - - -def insert(root, newValue): - # if binary search tree is empty, make a new node and declare it as root - if root is None: - root = BinaryTreeNode(newValue) - return root - # binary search tree is not empty, so we will insert it into the tree - # if newValue is less than value of data in root, add it to left subtree and proceed recursively - if newValue < root.data: - root.leftChild = insert(root.leftChild, newValue) - else: - # if newValue is greater than value of data in root, add it to right subtree and proceed recursively - root.rightChild = insert(root.rightChild, newValue) - return root - - -root = insert(None, 15) -insert(root, 10) -insert(root, 25) -insert(root, 6) -insert(root, 14) -insert(root, 20) -insert(root, 60) -a1 = root -a2 = a1.leftChild -a3 = a1.rightChild -a4 = a2.leftChild -a5 = a2.rightChild -a6 = a3.leftChild -a7 = a3.rightChild -print("Root Node is:") -print(a1.data) -print("left child of node is:") -print(a1.leftChild.data) -print("right child of node is:") -print(a1.rightChild.data) -print("Node is:") -print(a2.data) -print("left child of node is:") -print(a2.leftChild.data) -print("right child of node is:") -print(a2.rightChild.data) -print("Node is:") -print(a3.data) -print("left child of node is:") -print(a3.leftChild.data) -print("right child of node is:") -print(a3.rightChild.data) -print("Node is:") -print(a4.data) -print("left child of node is:") -print(a4.leftChild) -print("right child of node is:") -print(a4.rightChild) -print("Node is:") -print(a5.data) -print("left child of node is:") -print(a5.leftChild) -print("right child of node is:") -print(a5.rightChild) -print("Node is:") -print(a6.data) -print("left child of node is:") -print(a6.leftChild) -print("right child of node is:") -print(a6.rightChild) -print("Node is:") -print(a7.data) -print("left child of node is:") -print(a7.leftChild) -print("right child of node is:") -print(a7.rightChild) \ No newline at end of file diff --git a/binary_search_tree_using_deletion.py b/binary_search_tree_using_deletion.py deleted file mode 100644 index 7a5b888..0000000 --- a/binary_search_tree_using_deletion.py +++ /dev/null @@ -1,130 +0,0 @@ -# 31-12-22 -# binary search tree deletion -## Implement binary search tree deletion function -class Node(object): - # Initializing to None - def __init__(self): - self.left = None - self.right = None - self.data = None - - -# Inserting a node in Binary search tree -def insertion(val): - # Condition if this is a first node then it will be considered as a root - if (root.data == None): - print(val, " Inserted as root") - root.data = val - # Else part will be executed for all the other insertions - else: - # Pointer to move around tree to search for a place of new node - p = root - - # Creating a new node and writing a value in the data part - n = Node() - n.data = val - - # Iterating to search for an appropriate place of new node - while (1): - # if val is less than the current node p indicates that new node will be inserted on left subtree - if (val < p.data): - if (p.left == None): - print(val, " Inserted on left of ", p.data) - p.left = n - break - else: - p = p.left - # if val is greater than the current node p indicates that new node will be inserted on right subtree - else: - if (p.right == None): - print(val, " Inserted on right of", p.data) - p.right = n - break - else: - p = p.right - - -def inorder(node): - if node: - # Traversing left subtree - inorder(node.left) - # Visiting node - print(node.data) - # Traversing right subtree - inorder(node.right) - - -def deletion(value): - # If tree is empty - if (root == None): - print("Tree is empty") - - # Initializing the pointers to traverse a tree - p = root - q = root - - # Searching for a node to be deleted - while (1): - if (value > p.data): - q = p - p = p.right - elif (value < p.data): - q = p - p = p.left - else: - break - - # If the desired node is a leaf node this condition will be true - if (p.left == None and p.right == None): - if (q.left == p): - q.left = None - else: - q.right = None - print("Value deleted from leaf") - return p.data - - # deletion of node with one child on right - if (p.left == None and p.right != None): - print("\ndeleting node having only right subtree") - if (q.left == p): - q.left = p.right - else: - q.right = p.right - return p.data - - # Deletion of node with one child on left - if (p.left != None and p.right == None): - print("\ndeleting node having only left subtree") - if (q.left == p): - q.left = p.left - else: - q.right = p.left - return p.data - - # deletion of node having 2 childs - if (p.left != None and p.right != None): - temp = p - temp1 = p.right - while (temp1.left != None): - temp = temp1 - temp1 = temp1.left - if (temp1 == temp.left): - print("\ndeleting node having two childs & right subtree") - temp.left = temp1.right - else: - print("\ndeleting node having two childs & Only right node ") - temp.right = temp1.right - p.data = temp1.data - return value - - -root = Node() -insertion(10) -insertion(5) -insertion(20) -insertion(30) -insertion(25) -insertion(2) - -print("Value ", deletion(25), "deleted successfully") -print("Value ", deletion(10), "deleted successfully") \ No newline at end of file diff --git a/binary_search_tree_using_queue.py b/binary_search_tree_using_queue.py deleted file mode 100644 index 855363e..0000000 --- a/binary_search_tree_using_queue.py +++ /dev/null @@ -1,47 +0,0 @@ -# 2-01-23 -# binary search tree using queue -from queue import Queue - - -class BinaryTreeNode: - def __init__(self, data): - self.data = data - self.leftChild = None - self.rightChild = None - - -def insert(root, newValue): - # if binary search tree is empty, make a new node and declare it as root - if root is None: - root = BinaryTreeNode(newValue) - return root - # binary search tree is not empty, so we will insert it into the tree - # if newValue is less than value of data in root, add it to left subtree and proceed recursively - if newValue < root.data: - root.leftChild = insert(root.leftChild, newValue) - else: - # if newValue is greater than value of data in root, add it to right subtree and proceed recursively - root.rightChild = insert(root.rightChild, newValue) - return root - - -def deleteTree(root): - if root: - # delete left subtree - deleteTree(root.leftChild) - # delete right subtree - deleteTree(root.rightChild) - # traverse root - print("Deleting Node:", root.data) - del root - - -root = insert(None, 15) -insert(root, 10) -insert(root, 25) -insert(root, 6) -insert(root, 14) -insert(root, 20) -insert(root, 60) -print("deleting all the elements of the binary tree.") -deleteTree(root) \ No newline at end of file diff --git a/binary_search_using_iterative.py b/binary_search_using_iterative.py deleted file mode 100644 index ed6b13a..0000000 --- a/binary_search_using_iterative.py +++ /dev/null @@ -1,36 +0,0 @@ -# 12- 12- 2022 -# binary search using iterative -def binarySearch(v, To_Find): - lo = 0 - hi = len(v) - 1 - - # This below check covers all cases , so need to check - # for mid=lo-(hi-lo)/2 - while hi - lo > 1: - mid = (hi + lo) // 2 - if v[mid] < To_Find: - lo = mid + 1 - else: - hi = mid - - if v[lo] == To_Find: - print("Index found", lo) - elif v[hi] == To_Find: - print("Index found ", hi) - else: - print("Not Found") - - -if __name__ == '__main__': - v = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] - - To_Find = 5 - binarySearch(v, To_Find) - - To_Find = 10 - binarySearch(v, To_Find) - - To_Find = 1 - binarySearch(v, To_Find) - - diff --git a/binary_tree_example.py b/binary_tree_example.py deleted file mode 100644 index d6b1112..0000000 --- a/binary_tree_example.py +++ /dev/null @@ -1,86 +0,0 @@ -# 29-12-22 -# binary tree example -class BinaryTreeNode: - def __init__(self, data): - self.data = data - self.leftChild = None - self.rightChild = None - - -a1 = BinaryTreeNode(10) -a2 = BinaryTreeNode(15) -a3 = BinaryTreeNode(20) -a4 = BinaryTreeNode(60) -a5 = BinaryTreeNode(14) -a6 = BinaryTreeNode(25) -a7 = BinaryTreeNode(6) - -a1.leftChild = a2 -a1.rightChild = a3b -a2.leftChild = a4 -a2.rightChild = a5 -a3.leftChild = a6 -a3.rightChild = a7 - -print("Root Node is:") -print(a1.data) - -print("left child of node is:") -print(a1.leftChild.data) - -print("right child of node is:") -print(a1.rightChild.data) - -print("Node is:") -print(a2.data) - -print("left child of node is:") -print(a2.leftChild.data) - -print("right child of node is:") -print(a2.rightChild.data) - -print("Node is:") -print(a3.data) - -print("left child of node is:") -print(a3.leftChild.data) - -print("right child of node is:") -print(a3.rightChild.data) - -print("Node is:") -print(a4.data) - -print("left child of node is:") -print(a4.leftChild) - -print("right child of node is:") -print(a4.rightChild) - -print("Node is:") -print(a5.data) - -print("left child of node is:") -print(a5.leftChild) - -print("right child of node is:") -print(a5.rightChild) - -print("Node is:") -print(a6.data) - -print("left child of node is:") -print(a6.leftChild) - -print("right child of node is:") -print(a6.rightChild) - -print("Node is:") -print(a7.data) - -print("left child of node is:") -print(a7.leftChild) - -print("right child of node is:") -print(a7.rightChild) \ No newline at end of file diff --git a/binary_tree_iterative_method.py b/binary_tree_iterative_method.py deleted file mode 100644 index 597f2e6..0000000 --- a/binary_tree_iterative_method.py +++ /dev/null @@ -1,43 +0,0 @@ -# 29-12-22 -# binary tree iterative method -class Node: - def __init__(self, data): - self.left = None - self.right = None - self.data = data - - def PrintTree ( self ) : - if self.left : - self.left.PrintTree () - print ( self.data, end= ' ' ) , - if self.right : - self.right.PrintTree () - -class Solution: - ''' - Function to invert the tree - ''' - def invertTree(self, root): - if root == None: - return - root.left, root.right = self.invertTree(root.right),self.invertTree(root.left) - return root - -if __name__ == '__main__': - ''' - 10 10 - / \ / \ - 20 30 ========>> 30 20 - / \ / \ - 40 50 50 40 - ''' - Tree = Node(10) - Tree.left = Node(20) - Tree.right = Node(30) - Tree.left.left = Node(40) - Tree.right.right = Node(50) - print('Initial Tree :',end = ' ' ) - Tree.PrintTree() - Solution().invertTree(root=Tree) - print('\nInverted Tree :', end=' ') - Tree.PrintTree() \ No newline at end of file diff --git a/boolean_operator.py b/boolean_operator.py deleted file mode 100644 index ecd2759..0000000 --- a/boolean_operator.py +++ /dev/null @@ -1,9 +0,0 @@ -def myfunction(): - return true - -if __name__ == "__main__": - print('yes') -else : - print('no') - - diff --git a/break_statement_in_a_for_loop.py b/break_statement_in_a_for_loop.py deleted file mode 100644 index a4dc357..0000000 --- a/break_statement_in_a_for_loop.py +++ /dev/null @@ -1,13 +0,0 @@ -# 7-1-23 -# print first 5 multiples of any number -# program to find first 5 multiples of 6 - -i = 1 - -while i <= 10: - print('10 * ', i, '=', 10 * i) - - if i >= 5: - break - - i = i + 1 \ No newline at end of file diff --git a/break_statement_using_for_loop_ex1.py b/break_statement_using_for_loop_ex1.py deleted file mode 100644 index 8fcc199..0000000 --- a/break_statement_using_for_loop_ex1.py +++ /dev/null @@ -1,9 +0,0 @@ -# 7-2-23 -for i in range(1, 11): - print('Multiplication table of', i) - for j in range(1, 11): - # condition to break inner loop - if i > 5 and j > 5: - break - print(i * j, end=' ') - print('') diff --git a/break_while_loop.py b/break_while_loop.py deleted file mode 100644 index 91f5adf..0000000 --- a/break_while_loop.py +++ /dev/null @@ -1,8 +0,0 @@ -# 8-2-23 -# break while loop -i = 1 -while i <= 100: - print(i) - if i == 15: - break - i += 1 diff --git a/bubble_sort.py b/bubble_sort.py deleted file mode 100644 index 70e932d..0000000 --- a/bubble_sort.py +++ /dev/null @@ -1,37 +0,0 @@ -# 13-12-22 -# bubble sort -# - -def bubbleSort(arr): - n = len(arr) - # optimize code, so if the array is already sorted, it doesn't need - # to go through the entire process - swapped = False - # Traverse through all array elements - for i in range(n - 1): - # range(n) also work but outer loop will - # repeat one time more than needed. - # Last i elements are already in place - for j in range(0, n - i - 1): - - # traverse the array from 0 to n-i-1 - # Swap if the element found is greater - # than the next element - if arr[j] > arr[j + 1]: - swapped = True - arr[j], arr[j + 1] = arr[j + 1], arr[j] - - if not swapped: - # if we haven't needed to make a single swap, we - # can just exit the main loop. - return - - -# Driver code to test above -arr = [1,4,19,5,48,22,39,2,63,45,99,58,30,100,90] - -bubbleSort(arr) - -print("Sorted array is:") -for i in range(len(arr)): - print("% d" % arr[i], end=" ") diff --git a/bubble_sort_example.py b/bubble_sort_example.py deleted file mode 100644 index 67a74d4..0000000 --- a/bubble_sort_example.py +++ /dev/null @@ -1,21 +0,0 @@ -# 14-12-2022 -# bubble sort example -def bubblesort(elements): - size = len(elements) - - for i in range(size - 1): - # compare both elements - if elements[i] > elements[i + 1]: - temp = elements[i] - elements[i] = elements[i + 1] - elements[i] = temp - - -if __name__ == '__main__': - elements = [ - {'name': 'kathy', 'transaction_amount': 200, 'device': 'vivo'}, - {'name': 'dhaval', 'transaction_amount': 400, 'device': 'google pixel'}, - {'name': 'aamir', 'transaction_amount': 800, 'device': 'iphone-8'}, - {'name': 'mona', 'transaction_amount': 1000, 'device': 'iphone-10'}, ] - bubblesort(elements, key='transaction_amount') - print(bubblesort) diff --git a/bubblesort_simple_program.py b/bubblesort_simple_program.py deleted file mode 100644 index cafc66e..0000000 --- a/bubblesort_simple_program.py +++ /dev/null @@ -1,19 +0,0 @@ -# 15-12-22 -# bubblesort simple program -def bubble_sort(nlist): - for i in range(len(nlist) - 1, 0, -1): - no_swap = True - for j in range(0, i): - if nlist[j + 1] < nlist[j]: - nlist[j], nlist[j + 1] = nlist[j + 1], nlist[j] - no_swap = False - if no_swap: - return - -#input list -alist = [1, 74, 96, 5, 42, 63] -print('Input List\n', alist) - -#sort list -bubble_sort(alist) -print('Sorted List\n', alist) \ No newline at end of file diff --git a/bubblesort_using_array.py b/bubblesort_using_array.py deleted file mode 100644 index 4eec3c8..0000000 --- a/bubblesort_using_array.py +++ /dev/null @@ -1,27 +0,0 @@ -# 14-12-2022 -# bubble sort using array -# Bubble sort in Python - -def bubbleSort(array): - # loop to access each array element - for i in range(len(array)): - - # loop to compare array elements - for j in range(0, len(array) - i - 1): - - # compare two adjacent elements - # change > to < to sort in descending order - if array[j] > array[j + 1]: - # swapping elements if elements - # are not in the intended order - temp = array[j] - array[j] = array[j + 1] - array[j + 1] = temp - - -data = [11, 15, 6, 9, 8, 1, 5, 2, 3, 21] - -bubbleSort(data) - -print('Sorted Array in Ascending Order:') -print(data) \ No newline at end of file diff --git a/bubblesort_using_while_loop.py b/bubblesort_using_while_loop.py deleted file mode 100644 index 95b16d3..0000000 --- a/bubblesort_using_while_loop.py +++ /dev/null @@ -1,22 +0,0 @@ -# 15-12-22 -# bubble sort using while loop -# create a empty list -a = [] -number = int(input("Please Enter the Total Number of Elements : ")) -for i in range(number): - value = int(input("Please enter the %d Element : " %i)) - a.append(value) - -i = 0 -while i < number -1: - j = 0 - while j < number - i - 1: - if a[j] > a[j + 1]: - temp = a[j] - a[j] = a[j + 1] - a[j + 1] = temp - j = j + 1 - i = i + 1 - -print("The List in Ascending Order : ", a) - diff --git a/byte_array,py.py b/byte_array,py.py deleted file mode 100644 index 1506097..0000000 --- a/byte_array,py.py +++ /dev/null @@ -1,11 +0,0 @@ -#program to understand bytearray type array -#create a list of byte numbers -elements=[10,20,30,40,50] -#convert the list into byte array type array -x=bytearray(elements) -#modify the first two numbers -x[3]=75 -x[4]=45 -#retrieve elements from x using for loop and display -for i in x: - print(i) diff --git a/byte_array.py b/byte_array.py deleted file mode 100644 index 323421d..0000000 --- a/byte_array.py +++ /dev/null @@ -1,12 +0,0 @@ -#program to understand bytearray type array -#create a list of byte numbers -elements=[10,20,30,40,50] -#convert the list into byte array type array -x=bytearray(elements) -#modify the first two numbers -x[3]=75 -x[4]=45 - -#retrieve elements from x using for loop and display -for i in x: - print(i) diff --git a/byte_types_array.py b/byte_types_array.py deleted file mode 100644 index 327dd81..0000000 --- a/byte_types_array.py +++ /dev/null @@ -1,8 +0,0 @@ -# program to understand bytes type array -# create a list into byte numbers -elements=[10,20,30,40,50,60,70,80] -#convert the list into bytes type array -x=bytes(elements) -#retrieve elements from x using for loop and display -for i in x: - print(i) \ No newline at end of file diff --git a/calender.py b/calender.py deleted file mode 100644 index c887331..0000000 --- a/calender.py +++ /dev/null @@ -1,10 +0,0 @@ -# Program to display calender of the given month and year -#importing calender Module -import calendar -yy = 2020 #year -mm = 12 #month -# To take month and year input from the user -# yy = int(input("Enter year:")) -# mm = int(input("Enter month:")) -#display the calender -print(calendar.month(yy,mm)) diff --git a/check_file_size.py b/check_file_size.py deleted file mode 100644 index d151722..0000000 --- a/check_file_size.py +++ /dev/null @@ -1,4 +0,0 @@ -from pathlib import Path - -file = Path('my_file.txt') -print(file.stat().st_size) \ No newline at end of file diff --git a/check_if_two_arrays_are_equal_or_not.py b/check_if_two_arrays_are_equal_or_not.py deleted file mode 100644 index 3a3c16e..0000000 --- a/check_if_two_arrays_are_equal_or_not.py +++ /dev/null @@ -1,31 +0,0 @@ -# 5-8-22 -# check if two array are equal or not -def areequal(arr1, arr2, j, s): - - if(j !=s): - return False - - # sort both array - arr1.sort() - arr2.sort() - - # linearly compare - for i in range(0,j): - if(arr1[i] != arr2[i]): - return False - - # If all elements are same - return True - -# Driver Code -if __name__ == "__main__": - arr1 = [3, 5, 2, 5, 2] - arr2 = [2, 3, 5, 5, 2] - j = len(arr1) - s = len(arr2) - - if (areequal(arr1, arr2, j, s)): - print("Yes") - else: - print("No") - diff --git a/command_line_arguments.py b/command_line_arguments.py deleted file mode 100644 index 6b47671..0000000 --- a/command_line_arguments.py +++ /dev/null @@ -1,12 +0,0 @@ -#find sum of even numbers -import sys -#read command line arguments except the program name -args=sys.args[1:] -print(args) -sum=0 -#find sum of even arguments -for a in args: - x=int(a) - ifx%2=0 - sum+=x -print('sum of events=',sum) \ No newline at end of file diff --git a/continue_statement_in_for_loop.py b/continue_statement_in_for_loop.py deleted file mode 100644 index b88b52b..0000000 --- a/continue_statement_in_for_loop.py +++ /dev/null @@ -1,13 +0,0 @@ -# 10-2-23 -# remove any number in the range of 1 to 10 -for i in range(1, 11): - - # If i is equals to 6, - # continue to next iteration - # without printing - if i == 6: - continue - else: - # otherwise print the value - # of i - print(i, end=" ") diff --git a/continue_statement_in_for_loop_example.py b/continue_statement_in_for_loop_example.py deleted file mode 100644 index 7ec78e2..0000000 --- a/continue_statement_in_for_loop_example.py +++ /dev/null @@ -1,8 +0,0 @@ -# 10-2-23 -# to print any number of multiplication -for number in range(1, 51): - if (number % 7) != 0: - # the current number is not a multiple of 7, so continue until the next number - continue - - print(f'{number} is a multiple of 7') diff --git a/convert_numbers_obh_system.py b/convert_numbers_obh_system.py deleted file mode 100644 index 41eb3d6..0000000 --- a/convert_numbers_obh_system.py +++ /dev/null @@ -1,9 +0,0 @@ -n1="17" -n2="1110010" -n3="1c2" -n=int(n1,8) -print('octal 17 =',n) -n=int(n2,2) -print('binary 1110010 = ',n) -n=int(n3,16) -print('hexadecimal 1c2=',n) \ No newline at end of file diff --git a/count program.py b/count program.py deleted file mode 100644 index 745e302..0000000 --- a/count program.py +++ /dev/null @@ -1,5 +0,0 @@ -count = 0 -while (count < 9): - print('The count is: ',count) - count = count+1 -print ("Good Bye!") diff --git a/count_less_than.py b/count_less_than.py deleted file mode 100644 index e52f022..0000000 --- a/count_less_than.py +++ /dev/null @@ -1,6 +0,0 @@ -count = 0 -while count < 5: - print(count," is less than 5") - count = count+1 -else: - print (count, "is not less than 5") diff --git a/dictionary_.py b/dictionary_.py deleted file mode 100644 index 7e43fcf..0000000 --- a/dictionary_.py +++ /dev/null @@ -1,5 +0,0 @@ -# 16-1-23 -# dictionary -dict = {'Name': 'Jalpa', 'Age': 18, 'Class': 'MCA'} -print("dict['Name']: ", dict['Name']) -print("dict['Age']: ", dict['Age']) diff --git a/dictionary_example.py b/dictionary_example.py deleted file mode 100644 index c71a081..0000000 --- a/dictionary_example.py +++ /dev/null @@ -1,13 +0,0 @@ -# 16-1-23 -# dictionary example -Employee = {"Name": "David", "Age": 30, "salary":55000,"Company":"GOOGLE"} -print(type(Employee)) -print("printing Employee data .... ") -print(Employee) -print("Enter the details of the new employee....") -Employee["Name"] = input("Name: ") -Employee["Age"] = int(input("Age: ")) -Employee["salary"] = int(input("Salary: ")) -Employee["Company"] = input("Company:") -print("printing the new data") -print(Employee) diff --git a/divide_another_number.py b/divide_another_number.py deleted file mode 100644 index e0750e9..0000000 --- a/divide_another_number.py +++ /dev/null @@ -1,8 +0,0 @@ -# Take a list of numbers -my_list = [12, 65, 54, 39, 102, 339, 221,] - -# use anonymous function to filter -result = list(filter(lambda x: (x % 13 == 0), my_list)) - -# display the result -print("Numbers divisible by 13 are",result) \ No newline at end of file diff --git a/do_while_loop.py b/do_while_loop.py deleted file mode 100644 index 590393f..0000000 --- a/do_while_loop.py +++ /dev/null @@ -1,9 +0,0 @@ -# 4-2-23 -# to print any 5 numbers using do while loop -i = 1 - -while True: - print(i) - i = i + 1 - if (i > 5): - break diff --git a/doc_string.py b/doc_string.py deleted file mode 100644 index e46f3b3..0000000 --- a/doc_string.py +++ /dev/null @@ -1,11 +0,0 @@ -def message(): - ''' - this function displays a message - this is a welcome to the user - ''' - print("python was developed by guido van rossum ") - - -#now call the functions -a=(10,25) -message() \ No newline at end of file diff --git a/even_or_odd_number.py b/even_or_odd_number.py deleted file mode 100644 index db43248..0000000 --- a/even_or_odd_number.py +++ /dev/null @@ -1,8 +0,0 @@ -# python program to check if the input number is odd or even . -# A number is even if division by 2 gives reminder of 0. -# If the number is 1 , it is an odd number -num =(int(input("Enter a number:"))) -if (num %2) == 0: - print("{0} is Even".format(num)) -else: - print("{0} is Odd" .format(num)) \ No newline at end of file diff --git a/exception_handling.py b/exception_handling.py deleted file mode 100644 index 08cf14f..0000000 --- a/exception_handling.py +++ /dev/null @@ -1,13 +0,0 @@ -# 8-12-22 -# exception handling -# Function which returns a/b - -a = [1, 2, 3] -try: - print("Second element = %d" %(a[1])) - - # Throws error since there are only 3 elements in array - print("Fourth element = %d" %(a[3])) - -except: - print("An error occurred") diff --git a/exception_handling_finally_keyword.py b/exception_handling_finally_keyword.py deleted file mode 100644 index 88147b0..0000000 --- a/exception_handling_finally_keyword.py +++ /dev/null @@ -1,15 +0,0 @@ -# 8-12-22 -# exception handling finally keyword -# No exception Exception raised in try block -try: - k = 5//0 # raises divide by zero exception. - print(k) - -# handles zerodivision exception -except ZeroDivisionError: - print("Can't divide by zero") - -finally: - # this block is always executed - # regardless of exception generation. - print('This is always executed') diff --git a/factor_number.py b/factor_number.py deleted file mode 100644 index f0ce830..0000000 --- a/factor_number.py +++ /dev/null @@ -1,12 +0,0 @@ -# Python Program to find the factors of a number - -# This function computes the factor of the argument passed -def print_factors(x): - print("The factors of",x,"are:") - for i in range(1, x + 1): - if x % i == 0: - print(i) - -num = 320 - -print_factors(num) diff --git a/factorial_number.py b/factorial_number.py deleted file mode 100644 index 281661f..0000000 --- a/factorial_number.py +++ /dev/null @@ -1,17 +0,0 @@ -# python program to find the factorial of a number provided by the user . - -# change the value for a different result -num=7 -# To take input from the user -# num = int(input("Enter the number:")) - -factorial = 1 -# Check if the number is negative , positive and zero -if num<0: - print("Sorry , factorial doees not exit for negative numbers") -elif num==0: - print(" The factorial of 0 is 1") -else: - for i in range(1,num+1): - factorial = factorial*i - print(" The factorial of ",num,"is",factorial) \ No newline at end of file diff --git a/find_an_array_is_subset_of_another_array.py b/find_an_array_is_subset_of_another_array.py deleted file mode 100644 index 04c2830..0000000 --- a/find_an_array_is_subset_of_another_array.py +++ /dev/null @@ -1,37 +0,0 @@ -# 9-12-22 -# find an array is subset of another array -# Return 1 if arr2[] is a subset of arr1[] */ - - -def isSubset(arr1, arr2, m, n): - i = 0 - j = 0 - if m < n: - return 0 - - arr1.sort() - arr2.sort() - - while i < n and j < m: - if arr1[j] < arr2[i]: - j += 1 - elif arr1[j] == arr2[i]: - j += 1 - i += 1 - elif arr1[j] > arr2[i]: - return 0 - return False if i < n else True - - -# Driver code -arr1 = [11, 1, 13, 21, 3, 7] -arr2 = [11, 3, 7, 1] - -m = len(arr1) -n = len(arr2) -if isSubset(arr1, arr2, m, n) == True: - print("arr2 is subset of arr1 ") -else: - printf("arr2 is not a subset of arr1 ") - - diff --git a/first_variable_program (2).py b/first_variable_program (2).py deleted file mode 100644 index 5009439..0000000 --- a/first_variable_program (2).py +++ /dev/null @@ -1,6 +0,0 @@ -x=5 -y=10 -z='hello' -print(type(x)) -print(type(y)) -print(type(z)) \ No newline at end of file diff --git a/first_variable_program.py b/first_variable_program.py deleted file mode 100644 index e0a2beb..0000000 --- a/first_variable_program.py +++ /dev/null @@ -1,16 +0,0 @@ -a=b=c=d=e=f=g=h=i=j=60 -print(a) -print(b) -print(c) -print(d) -print(e) -print(f) -print(g) -print(h) -print(i) -print(j) - -a=a+10 - -print(a) -print(b) \ No newline at end of file diff --git a/for_loop.py b/for_loop.py deleted file mode 100644 index 40cd334..0000000 --- a/for_loop.py +++ /dev/null @@ -1,7 +0,0 @@ -# 30-1-23 -# for loop -forecast = {'Mon': 'Rainy', 'Tues': 'Partly Cloudy', 'Wed': 'Sunny', 'Thu': 'Windy', 'Fri': 'Warm', 'Sat': 'Hot', - 'Sun': 'Clear'} - -for day, weather in forecast.items(): - print(day + ' will be ' + weather) \ No newline at end of file diff --git a/for_loop_ex1.py b/for_loop_ex1.py deleted file mode 100644 index f6c1729..0000000 --- a/for_loop_ex1.py +++ /dev/null @@ -1,13 +0,0 @@ -# 27-1-23 -# sum of list of elements using for loop -# creating the list of numbers -numbers = [3, 5, 23, 6, 5, 1, 2, 9, 8] - -# initializing a variable that will store the sum -sum = 0 - -# using for loop to iterate over the list -for num in numbers: - sum = sum + num ** 2 - -print("The sum of squares is: ", sum) diff --git a/for_loop_example.py b/for_loop_example.py deleted file mode 100644 index 30ceec5..0000000 --- a/for_loop_example.py +++ /dev/null @@ -1,8 +0,0 @@ -# 27-8-23 -# for loop example -digits = [0, 1, 5] - -for i in digits: - print(i) -else: - print("No items left.") \ No newline at end of file diff --git a/hash_table.py b/hash_table.py deleted file mode 100644 index 2ac57ac..0000000 --- a/hash_table.py +++ /dev/null @@ -1,50 +0,0 @@ -# 9-12-22 -# hashtable -# Python program to demonstrate working of HashTable - -hashTable = [[],] * 10 - -def checkPrime(n): - if n == 1 or n == 0: - return 0 - - for i in range(2, n//2): - if n % i == 0: - return 0 - - return 1 - - -def getPrime(n): - if n % 2 == 0: - n = n + 1 - - while not checkPrime(n): - n += 2 - - return n - - -def hashFunction(key): - capacity = getPrime(10) - return key % capacity - - -def insertData(key, data): - index = hashFunction(key) - hashTable[index] = [key, data] - -def removeData(key): - index = hashFunction(key) - hashTable[index] = 0 - -insertData(123, "apple") -insertData(432, "mango") -insertData(213, "banana") -insertData(654, "guava") - -print(hashTable) - -removeData(123) - -print(hashTable) \ No newline at end of file diff --git a/if....else.....statement.py b/if....else.....statement.py deleted file mode 100644 index 5988b6a..0000000 --- a/if....else.....statement.py +++ /dev/null @@ -1,7 +0,0 @@ -#19 Jan 2022 -# Using 'and' in if....else statement -x=int(input('enter a number:')) -if x>=1 and x<=10: - print("you typed",x,"which is between 1 and 10") -else: - print("you typed",x,"which is below 1 or above 10") \ No newline at end of file diff --git a/if.py b/if.py deleted file mode 100644 index 5c6e89b..0000000 --- a/if.py +++ /dev/null @@ -1,9 +0,0 @@ -# 19-1-23 -# if__else_example1 -x = 5 -y = 3 - -if x < y: - print("x is smaller than y.") -else: - print("x is greater than y.") diff --git a/if__elif__example1.py b/if__elif__example1.py deleted file mode 100644 index 5977d03..0000000 --- a/if__elif__example1.py +++ /dev/null @@ -1,11 +0,0 @@ -# 20-1-23 -# if__elif__example1 -number = int(input("Enter the number?")) -if number == 10: - print("number is equals to 10") -elif number == 50: - print("number is equal to 50") -elif number == 100: - print("number is equal to 100") -else: - print("number is not equal to 10, 50 or 100") diff --git a/if__else.py b/if__else.py deleted file mode 100644 index 9d70845..0000000 --- a/if__else.py +++ /dev/null @@ -1,6 +0,0 @@ -# 18-1-23 -age = int(input("Enter your age? ")) -if age >= 18: - print("You are eligible to vote !!") -else: - print("Sorry! you are not eligible for vote!") diff --git a/if__else__example.py b/if__else__example.py deleted file mode 100644 index 145f092..0000000 --- a/if__else__example.py +++ /dev/null @@ -1,11 +0,0 @@ -# 19-1-2022 -# if__else__example -a = 5 -b = 6 - -if a > b: - print("First number is the largest") -elif a < b: - print("Second number is the largest") -else: - print("a and b are equal ") diff --git a/if_else_if_example.py b/if_else_if_example.py deleted file mode 100644 index ff6d6cf..0000000 --- a/if_else_if_example.py +++ /dev/null @@ -1,10 +0,0 @@ -# 20-1-2023 -# if__else__if__example -number = 10 - -if number > 0: - print(" positive numbers") -elif number == 0: - print(" zeros") -else: - Print("Negative numbers") diff --git a/if_else_if_program.py b/if_else_if_program.py deleted file mode 100644 index 7b2ec35..0000000 --- a/if_else_if_program.py +++ /dev/null @@ -1,15 +0,0 @@ -# 23-01-22 -# if__else__if -x = 10 -y = 15 - -if x == 10: - print("x equals 10.") - if y > 20: - print("y is greater than 20.") - elif y < 20: - print("y is less than 20.") - else: - print("y equals 20.") -else: - print("x does not match.") diff --git a/if_statement.py b/if_statement.py deleted file mode 100644 index 9e1d68d..0000000 --- a/if_statement.py +++ /dev/null @@ -1,13 +0,0 @@ -#19 JAN 2022 -#Understanding If statements -num=1 -if num==1: - print("One") - - -str='Yes' -if str=='Yes': - print("Yes") - print("This Is What You Said") - print("Your Response Is Good") - \ No newline at end of file diff --git a/illustrate_set_operaton.py b/illustrate_set_operaton.py deleted file mode 100644 index 110ccf6..0000000 --- a/illustrate_set_operaton.py +++ /dev/null @@ -1,17 +0,0 @@ - # Program to perform different set operations like in mathematics - -# define three sets -E = {0, 2, 4, 6, 8}; -N = {1, 2, 3, 4, 5}; - -# set union -print("Union of E and N is",E | N) - -# set intersection -print("Intersection of E and N is",E & N) - -# set difference -print("Difference of E and N is",E - N) - -# set symmetric difference -print("Symmetric difference of E and N is",E ^ N) \ No newline at end of file diff --git a/index.md b/index.md new file mode 100644 index 0000000..2c896ce --- /dev/null +++ b/index.md @@ -0,0 +1,37 @@ +## Welcome to GitHub Pages + +You can use the [editor on GitHub](https://github.com/JaySimaria/python-programs/edit/gh-pages/index.md) to maintain and preview the content for your website in Markdown files. + +Whenever you commit to this repository, GitHub Pages will run [Jekyll](https://jekyllrb.com/) to rebuild the pages in your site, from the content in your Markdown files. + +### Markdown + +Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for + +```markdown +Syntax highlighted code block + +# Header 1 +## Header 2 +### Header 3 + +- Bulleted +- List + +1. Numbered +2. List + +**Bold** and _Italic_ and `Code` text + +[Link](url) and ![Image](src) +``` + +For more details see [Basic writing and formatting syntax](https://docs.github.com/en/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax). + +### Jekyll Themes + +Your Pages site will use the layout and styles from the Jekyll theme you have selected in your [repository settings](https://github.com/JaySimaria/python-programs/settings/pages). The name of this theme is saved in the Jekyll `_config.yml` configuration file. + +### Support or Contact + +Having trouble with Pages? Check out our [documentation](https://docs.github.com/categories/github-pages-basics/) or [contact support](https://support.github.com/contact) and we’ll help you sort it out. diff --git a/index_list_using_for_loop.py b/index_list_using_for_loop.py deleted file mode 100644 index 88ba62d..0000000 --- a/index_list_using_for_loop.py +++ /dev/null @@ -1,4 +0,0 @@ -my_list = [21, 44, 35, 11] - -for index, val in enumerate(my_list): - print(index, val) \ No newline at end of file diff --git a/inorder_traversal_in_tree.py b/inorder_traversal_in_tree.py deleted file mode 100644 index c152070..0000000 --- a/inorder_traversal_in_tree.py +++ /dev/null @@ -1,11 +0,0 @@ -# 28-12-22 -# inorder traversal in tree -class BTNode: - def __init__(self, val): - self.left = None - self.right = None - self.val = val - def rootNode(self): - print(self.val) -root = BTNode('A') -root.rootNode() \ No newline at end of file diff --git a/input_statements_program.py b/input_statements_program.py deleted file mode 100644 index 886a75a..0000000 --- a/input_statements_program.py +++ /dev/null @@ -1,3 +0,0 @@ -# accepting a single character or string from keyboard -ch=input("Enter a char :") -print("U entered: ",ch[0]) diff --git a/insertion_sort.py b/insertion_sort.py deleted file mode 100644 index 803c738..0000000 --- a/insertion_sort.py +++ /dev/null @@ -1,23 +0,0 @@ -# 17-12-22 -# insertion_sort - - -def insertionSort(array): - for step in range(1, len(array)): - key = array[step] - j = step - 1 - - # Compare key with each element on the left of it until an element smaller than it is found - # For descending order, change keyarray[j]. - while j >= 0 and key < array[j]: - array[j + 1] = array[j] - j = j - 1 - - # Place key at after the element just smaller than it. - array[j + 1] = key - - -data = [9, 5, 1, 4, 3,] -insertionSort(data) -print('Sorted Array in Ascending Order:') -print(data) \ No newline at end of file diff --git a/insertion_sort_example.py b/insertion_sort_example.py deleted file mode 100644 index d23e324..0000000 --- a/insertion_sort_example.py +++ /dev/null @@ -1,27 +0,0 @@ -# 19-12-22 -# insertion sort example -# Function to do insertion sort -def insertionSort(arr): - - # Traverse through 1 to len(arr) - for i in range(1, len(arr)): - - key = arr[i] - - # Move elements of arr[0..i-1], that are - # greater than key, to one position ahead - # of their current position - j = i-1 - while j >= 0 and key < arr[j] : - arr[j + 1] = arr[j] - j -= 1 - arr[j + 1] = key - - -# Driver code to test above -arr = [12, 11, 13, 5, 6] -insertionSort(arr) -for i in range(len(arr)): - print ("% d" % arr[i]) - - diff --git a/insertion_sort_example1.py b/insertion_sort_example1.py deleted file mode 100644 index 3117e24..0000000 --- a/insertion_sort_example1.py +++ /dev/null @@ -1,31 +0,0 @@ -# 18-12-22 -# insertion sort -def InSort(arr): - for i in range(1, len(arr)): - key = arr[i] - - # Algorithm Implementation - j = i - 1 - while j >= 0 and key < arr[j]: - arr[j + 1] = arr[j] - j -= 1 - arr[j + 1] = key - - -# Take Users Input -n = int(input("Mention the number of elements in the array : ")) -arr = [] -print("Enter the elements in the array") -for i in range(0, n): - # m represents the elements of the array - m = int(input()) - arr.append(m) - -# Display array before sorting -print("Array before Sorting :") -print(arr) - -InSort(arr) -print("Sorted array is:") -for i in range(len(arr)): - print("%d" % arr[i]) \ No newline at end of file diff --git a/insertion_sort_using_ex.py b/insertion_sort_using_ex.py deleted file mode 100644 index 53b2989..0000000 --- a/insertion_sort_using_ex.py +++ /dev/null @@ -1,17 +0,0 @@ -# 19-12-22 -# insertion sort using list -def insertionSort(list): - for index in range(1,len(list)): - - currentvalue = list[index] - position = index - - while position>0 and list[position-1]>currentvalue: - list[position]=list[position-1] - position = position-1 - - list[position]=currentvalue - -list = [54,26,93,17,77,31,44,55,20] -insertionSort(list) -print(list) diff --git a/interval_prime.py b/interval_prime.py deleted file mode 100644 index 351810b..0000000 --- a/interval_prime.py +++ /dev/null @@ -1,15 +0,0 @@ - #Python program to display all the prime numbers within an interval - -lower = 900 -upper = 1000 - -print("Prime numbers between", lower, "and", upper, "are:") - -for num in range(lower, upper + 1): - # all prime numbers are greater than 1 - if num > 1: - for i in range(2, num): - if (num % i) == 0: - break - else: - print(num) \ No newline at end of file diff --git a/is_not_operators.py b/is_not_operators.py deleted file mode 100644 index 685c30d..0000000 --- a/is_not_operators.py +++ /dev/null @@ -1,6 +0,0 @@ -one=[2,3,4,5] -two=[2,3,4,5] -if(one is two): - print("one and two have same identity") -else: - print("one and two do not have same identity") diff --git a/jay $.py b/jay $.py deleted file mode 100644 index 0586a13..0000000 --- a/jay $.py +++ /dev/null @@ -1,4 +0,0 @@ -def no(i): - assert(i>=0),"no is less than zero" - return(i) -print(no(-5)) diff --git a/joined_two_List.py b/joined_two_List.py deleted file mode 100644 index 937407e..0000000 --- a/joined_two_List.py +++ /dev/null @@ -1,5 +0,0 @@ -list_1 = [1, 'a'] -list_2 = [3, 4, 5] - -list_joined = list_1 + list_2 -print(list_joined) \ No newline at end of file diff --git a/json_2_program.py b/json_2_program.py deleted file mode 100644 index fb705ec..0000000 --- a/json_2_program.py +++ /dev/null @@ -1,15 +0,0 @@ -# Json 2 program -import json -json_input='[person{"name":"yamini","city":"banglore"),{"name":"parita","city":"pune"}]}' -try: - decorded=json.loads(json_input) - for x in decorded['person']: - print (x['city']) -except(KeyError,ValueError,TypeError): - print("JSON format error") - # json data display - import json - json_data='{"name":"yamini","city":"ahmedabad"}' - python_obj=json.loads(json_data) - print json.dumps(python_obj,sort_keys=true,indent=4) - # display in real json syntax indent will give spacce to string diff --git a/linear_search.py b/linear_search.py deleted file mode 100644 index 7529d3e..0000000 --- a/linear_search.py +++ /dev/null @@ -1,19 +0,0 @@ -# 3-01-22 -# linear_search -def linear_Search(list1, n, key): - # Searching list1 sequentially - for i in range(0, n): - if (list1[i] == key): - return i - return -1 - - -list1 = [1, 3, 5, 4, 7, 9] -key = 7 - -n = len(list1) -res = linear_Search(list1, n, key) -if (res == -1): - print("Element not found") -else: - print("Element found at index: ", res) \ No newline at end of file diff --git a/linear_search_ex1.py b/linear_search_ex1.py deleted file mode 100644 index e48715a..0000000 --- a/linear_search_ex1.py +++ /dev/null @@ -1,10 +0,0 @@ -# 3-1-23 -# binary search example -def linearsearch(arr, x): - for i in range(len(arr)): - if arr[i] == x: - return i - return -1 -arr = ['p','y','t','h','o','n','3'] -x = '3' -print("element found at index "+str(linearsearch(arr,x))) \ No newline at end of file diff --git a/linear_search_tree.py b/linear_search_tree.py deleted file mode 100644 index da23f8a..0000000 --- a/linear_search_tree.py +++ /dev/null @@ -1,21 +0,0 @@ -# 2-01-23 -# Linear Search in Python - - -def linearSearch(array, n, x): - - # Going through array sequencially - for i in range(0, n): - if (array[i] == x): - return i - return -1 - - -array = [2, 4, 0, 1, 9] -x = 1 -n = len(array) -result = linearSearch(array, n, x) -if(result == -1): - print("Element not found") -else: - print("Element found at index: ", result) \ No newline at end of file diff --git a/linear_search_using_array.py b/linear_search_using_array.py deleted file mode 100644 index 381c4d3..0000000 --- a/linear_search_using_array.py +++ /dev/null @@ -1,20 +0,0 @@ -# 4-1-2023 -# linear search array -def linear_search(arr, a, b): - - # Going through array - for i in range(0, a): - if (arr[i] == b): - return i - return -1 - -arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100] -print("The array given is ", arr) -b = 80 -print("Element to be found is ", b) -a = len(arr) -index = linear_search(arr, a, b) -if(index == -1): - print("Element is not in the list") -else: - print("Index of the element is: ", index) \ No newline at end of file diff --git a/linear_search_using_list.py b/linear_search_using_list.py deleted file mode 100644 index 8c56108..0000000 --- a/linear_search_using_list.py +++ /dev/null @@ -1,20 +0,0 @@ -# 4-1-23 -# linear search using list -def linear_search(list, key): - """Return index of key in alist. Return -1 if key not present.""" - for i in range(len(list)): - if list[i] == key: - return i - return -1 - - -list = input('Enter the list of numbers: ') -list = list.split() -list = [int(x) for x in list] -key = int(input('The number to search for: ')) - -index = linear_search(list, key) -if index < 0: - print('{} was not found.'.format(key)) -else: - print('{} was found at index {}.'.format(key, index)) \ No newline at end of file diff --git a/list_example.py b/list_example.py deleted file mode 100644 index 8514e66..0000000 --- a/list_example.py +++ /dev/null @@ -1,9 +0,0 @@ -# 5-1-22 -#!/usr/bin/python - -list = ['Python', 'Machine Learning', 1997, 7886]; -print ("Value available at index 0") -print (list[0]) -list[2] = 7886; -print ("New value available at index 1 ") -print (list[1]) \ No newline at end of file diff --git a/list_example1.py b/list_example1.py deleted file mode 100644 index e7e231d..0000000 --- a/list_example1.py +++ /dev/null @@ -1,13 +0,0 @@ -# 7-1-22 -# list example -# Taking one variable and integer -a = 20 -# creating an empty list -lst = [] -# number of elements as input -n = int(input("Enter number of elements : ")) -# iterating till the range -for i in range(0, n): - ele = int(input()) - lst.append(ele) # adding the element -print(lst) diff --git a/list_program.py b/list_program.py deleted file mode 100644 index 29d82bd..0000000 --- a/list_program.py +++ /dev/null @@ -1,4 +0,0 @@ -#list program -laptop=['dell','hp','macbook'] -print(laptop[-2]) -u \ No newline at end of file diff --git a/list_using_slicing.py b/list_using_slicing.py deleted file mode 100644 index f1c0b8d..0000000 --- a/list_using_slicing.py +++ /dev/null @@ -1,13 +0,0 @@ -# 6-01-23 -# list using slicing -list = [1, 2, 3, 4, 5, 6, 7] -print(list[0]) -print(list[1]) -print(list[2]) -print(list[3]) -# Slicing the elements -print(list[0:6]) -# By default, the index value is 0 so its starts from the 0th element and go for index -1. -print(list[:]) -print(list[2:5]) -print(list[1:6:2]) diff --git a/logical_operators.py b/logical_operators.py deleted file mode 100644 index 8dc330a..0000000 --- a/logical_operators.py +++ /dev/null @@ -1,11 +0,0 @@ -s=500 -j=1000 -print(s and j) # will display 1000 -print(s or j) # will display 500 -print(not s) # will display false - -s=1;j=2;r=3 -if(s= b: - return a - else: - return b - -# Driver code -a = 2 -b = 4 -print(maximum(a, b)) \ No newline at end of file diff --git a/merge_dictionary_ex1.py b/merge_dictionary_ex1.py deleted file mode 100644 index 9b4029f..0000000 --- a/merge_dictionary_ex1.py +++ /dev/null @@ -1,6 +0,0 @@ -# 17-1-23 -# merge dictionary -D1 = {'name': 'Jay'} -D2 = {'job': 'Devops engineer', 'age': 25} -D1.update(D2) -print(D1) diff --git a/merge_sort.py b/merge_sort.py deleted file mode 100644 index ecbda1f..0000000 --- a/merge_sort.py +++ /dev/null @@ -1,58 +0,0 @@ -# 19-12-2022 -# merge sort - - - -def mergeSort(array): - if len(array) > 1: - - # r is the point where the array is divided into two subarrays - r = len(array)//2 - L = array[:r] - M = array[r:] - - # Sort the two halves - mergeSort(L) - mergeSort(M) - - i = j = k = 0 - - # Until we reach either end of either L or M, pick larger among - # elements L and M and place them in the correct position at A[p..r] - while i < len(L) and j < len(M): - if L[i] < M[j]: - array[k] = L[i] - i += 1 - else: - array[k] = M[j] - j += 1 - k += 1 - - # When we run out of elements in either L or M, - # pick up the remaining elements and put in A[p..r] - while i < len(L): - array[k] = L[i] - i += 1 - k += 1 - - while j < len(M): - array[k] = M[j] - j += 1 - k += 1 - - -# Print the array -def printList(array): - for i in range(len(array)): - print(array[i], end=" ") - print() - - -# Driver program -if __name__ == '__main__': - array = [6, 5, 12, 10, 9, 1] - - mergeSort(array) - - print("Sorted array is: ") - printList(array) \ No newline at end of file diff --git a/merge_sort1.py b/merge_sort1.py deleted file mode 100644 index 5fa5c10..0000000 --- a/merge_sort1.py +++ /dev/null @@ -1,53 +0,0 @@ -# 21-12-22 -# merge sort 1 -#merge function -def merge(arr, l, m, r): - n1 = m - l + 1 - n2 = r- m - # create arrays - L = [0] * (n1) - R = [0] * (n2) - # Copy data to arrays - for i in range(0 , n1): - L[i] = arr[l + i] - for j in range(0 , n2): - R[j] = arr[m + 1 + j] - i = 0 # first half of array - j = 0 # second half of array - k = l # merges two halves - while i < n1 and j < n2 : - if L[i] <= R[j]: - arr[k] = L[i] - i += 1 - else: - arr[k] = R[j] - j += 1 - k += 1 - # copy the left out elements of left half - while i < n1: - arr[k] = L[i] - i += 1 - k += 1 - # copy the left out elements of right half - while j < n2: - arr[k] = R[j] - j += 1 - k += 1 -# sort -def mergeSort(arr,l,r): - if l < r: - # getting the average - m = (l+(r-1))/2 - - -# Sort -mergeSort(arr, l, m) -mergeSort(arr, m+1, r) -merge(arr, l, m, r) -# main -arr = [2, 5, 3, 8, 6, 5, 4, 7] -n = len(arr) -mergeSort(arr,0,n-1) -print ("Sorted array is") -for i in range(n): - print (arr[i],end=" ") \ No newline at end of file diff --git a/merge_sort_ex.py b/merge_sort_ex.py deleted file mode 100644 index 3e2cdeb..0000000 --- a/merge_sort_ex.py +++ /dev/null @@ -1,23 +0,0 @@ -# 20-12-22 -# merge sort ex - - -def merge_two_sorted_lists(a, b): - sorting_list=[] - len_a = len(a) - len_b = len(b) - - i = j = 0 - - while i < len_a and j < len_b: - if a[i] <= b[j]: - sorting_list.append(a[i]) - i+=1 - else: - sorting_list.append(b[j]) - j+=1 - - return sorting_list -if __name__ == '__main__': - a = [2,4,6,7.8] - b = [1,3,9,5,6] diff --git a/merge_sort_ex1.py b/merge_sort_ex1.py deleted file mode 100644 index ee22755..0000000 --- a/merge_sort_ex1.py +++ /dev/null @@ -1,23 +0,0 @@ -def merge_two_sorted_lists(a,b): - sorting_list=[] - len_a = len(a) - len_b = len(b) - i = j = 0 - - while i < len_a and j < len_b: - if a[i] <= b[j]: - sorting_list.append(a[i]) - i+=1 - else: - sorting_list.append(b[j]) - j+=1 - - - return sorting_list - - -if __name__ == '__main__': - a = [2,4,6,7,8] - b = [1,3,9,5,6] - - print(merge_two_sorted_lists(a,b)) diff --git a/merge_sort_using_list.py b/merge_sort_using_list.py deleted file mode 100644 index 8c52419..0000000 --- a/merge_sort_using_list.py +++ /dev/null @@ -1,33 +0,0 @@ -def mergeSort(nlist): - print("Splitting ",nlist) - if len(nlist)>1: - mid = len(nlist)//2 - lefthalf = nlist[:mid] - righthalf = nlist[mid:] - - mergeSort(lefthalf) - mergeSort(righthalf) - i=j=k=0 - while i < len(lefthalf) and j < len(righthalf): - if lefthalf[i] < righthalf[j]: - nlist[k]=lefthalf[i] - i=i+1 - else: - nlist[k]=righthalf[j] - j=j+1 - k=k+1 - - while i < len(lefthalf): - nlist[k]=lefthalf[i] - i=i+1 - k=k+1 - - while j < len(righthalf): - nlist[k]=righthalf[j] - j=j+1 - k=k+1 - print("Merging ",nlist) - -nlist = [14,46,43,27,57,41,45,21,70] -mergeSort(nlist) -print(nlist) \ No newline at end of file diff --git a/merge_two_dictionaries.py b/merge_two_dictionaries.py deleted file mode 100644 index 789d27e..0000000 --- a/merge_two_dictionaries.py +++ /dev/null @@ -1,11 +0,0 @@ -# 17-1-23 -# merge two dictionaries - -def merge(dict1, dict2): - result = dict1 | dict2 # merge operator (|) - return result - - -dict1 = {'A': 'Jay ', 'B': 'Messi ', 'C': 'Ronaldo'} -dict2 = {'D': 'Hardik Pandiya ', 'E': 'Rishabh pant', 'F': 'Kohli'} -print(merge(dict1, dict2)) # print dict3 diff --git a/multipication_table.py b/multipication_table.py deleted file mode 100644 index 53be5eb..0000000 --- a/multipication_table.py +++ /dev/null @@ -1,7 +0,0 @@ -# Multipication tble (1 t0 10) in python -num = 12 -# To take input from the user -# num = int(input("Display multipliction tble of?")) -#Iterate 10 timesfrom i = 1 to 10 -for i in range(1,11): - print(num,'x',i,'=',num*i) \ No newline at end of file diff --git a/multiplication_table.py b/multiplication_table.py deleted file mode 100644 index 5eb70d0..0000000 --- a/multiplication_table.py +++ /dev/null @@ -1,6 +0,0 @@ -num = 500 -#to take input from the user -#num=int(input("display multiplication table of?")) -#Iterate 10 times from i=1to 10 -for i in range(1,11): - print(num,'x',i,'=',num*i) \ No newline at end of file diff --git a/mutation_program.py b/mutation_program.py deleted file mode 100644 index 794dab9..0000000 --- a/mutation_program.py +++ /dev/null @@ -1,5 +0,0 @@ -f=["hi,jay shree krishna"] -print(f) -b=f -b+=["Mahadev"] -print(f) diff --git a/nested_.py b/nested_.py deleted file mode 100644 index 597a6db..0000000 --- a/nested_.py +++ /dev/null @@ -1 +0,0 @@ -i \ No newline at end of file diff --git a/nested_if.py b/nested_if.py deleted file mode 100644 index 58b70ec..0000000 --- a/nested_if.py +++ /dev/null @@ -1,17 +0,0 @@ -# 24-1-23 -# nested if -a = 40 -b = 80 -c = 70 - -if a > b: - if a > c: - print("a is greater") - -if b > a: - if b > c: - print("b is greatest") - -if c > a: - if c > b: - print("c is greatest") diff --git a/nested_if_ex1.py b/nested_if_ex1.py deleted file mode 100644 index b2a0c78..0000000 --- a/nested_if_ex1.py +++ /dev/null @@ -1,18 +0,0 @@ -# 25-1-23 -# nested if example -number = -5 - -# outer if statement -if number >= 0: - # inner if statement - if number == 0: - print('Number is 0') - - # inner else statement - else: - print('Number is positive') - -# outer else statement -else: - print('Number is negative') - diff --git a/nested_if_example.py b/nested_if_example.py deleted file mode 100644 index 1f6a7c0..0000000 --- a/nested_if_example.py +++ /dev/null @@ -1,20 +0,0 @@ -# 24-1-23 -# nested if example - -x = int(input("Enter your age: ")) - -y = int(input('Enter your age: ')) - -if x > 19: - - if y > 95: - - print('You are too old, go away!') - - else: - - print('Welcome, you are of the right age!') - -else: - - print('You are too young, go away!') diff --git a/nested_if_example2.py b/nested_if_example2.py deleted file mode 100644 index 0a30e91..0000000 --- a/nested_if_example2.py +++ /dev/null @@ -1,12 +0,0 @@ -# 25-01-22 -n = 9 -if n % 5 == 0: - if n % 3 == 0: - print("The number is divisible by both 5 and 3") - else: - print("The number is divisible by both 5 and 3") -else: - if n % 3 == 0: - print("The number is divisible by 3 but not 5") - else: - print("The number is not divisible by 5 and not divisible by 3") diff --git a/number.py b/number.py deleted file mode 100644 index 6509238..0000000 --- a/number.py +++ /dev/null @@ -1,9 +0,0 @@ -num = float(input("Enter a number:")) -if num >= 0: - if num == 0: - print("Zero") - else: - print("positive number") -else: - print("negative number") - \ No newline at end of file diff --git a/output_statements.py b/output_statements.py deleted file mode 100644 index 35d58db..0000000 --- a/output_statements.py +++ /dev/null @@ -1,3 +0,0 @@ -#output statements 1 program -print("\n I love my india") -print("\n Dreams come out ") \ No newline at end of file diff --git a/output_statements_with_variable_list.py b/output_statements_with_variable_list.py deleted file mode 100644 index 056aacd..0000000 --- a/output_statements_with_variable_list.py +++ /dev/null @@ -1,3 +0,0 @@ -a,b,c,d=2,4,6,8 -print(a) -print(a,b,c,d) \ No newline at end of file diff --git a/parameters_in_function_and_scoping.py b/parameters_in_function_and_scoping.py deleted file mode 100644 index 741b481..0000000 --- a/parameters_in_function_and_scoping.py +++ /dev/null @@ -1,6 +0,0 @@ -#Parameters -def my_function(fname): - print(fname+"refsnes") -my_function("Email") -my_function("Tobias") -my_function("Linux") \ No newline at end of file diff --git a/polymorphism_program.py b/polymorphism_program.py deleted file mode 100644 index 2ea3d61..0000000 --- a/polymorphism_program.py +++ /dev/null @@ -1,21 +0,0 @@ -#polymorphism -class parrot: - def fly(self): - print("parrot can fly") -def swim(self): - print("parrot can't swim") -class penguin: - def fly(self): - print("penguin can't fly") -def swim(self): - print("penguin can swim") -# common interface -def flying_test(bird): - bird.fly() -# object calling class - blu=parrot() - peggy=penguin() -# passing the object - flying_test(blu) - flying_test(peggy) - diff --git a/positive_and_negative_number_program_in_python.py b/positive_and_negative_number_program_in_python.py deleted file mode 100644 index 9369a41..0000000 --- a/positive_and_negative_number_program_in_python.py +++ /dev/null @@ -1,5 +0,0 @@ -num=float(input("Enter a Number")) -if num>0: - print("Positive Number") -else: - print("Negative number") \ No newline at end of file diff --git a/python specification program.py b/python specification program.py deleted file mode 100644 index fe21988..0000000 --- a/python specification program.py +++ /dev/null @@ -1,7 +0,0 @@ -class a - --a=2 - def(self) - print(--a) - obj=f() - print(--a) - obj a() \ No newline at end of file diff --git a/python_lists.py b/python_lists.py deleted file mode 100644 index a532a52..0000000 --- a/python_lists.py +++ /dev/null @@ -1,12 +0,0 @@ -# 6-1-23 -# python list - - -# Creating a List with -# the use of multiple values -List = ["I ", "Love", "My", "India"] - -# accessing a element from the -# list using index number -print("Accessing a element from the list") -print(List[3]) diff --git a/python_program_without_new_line.py b/python_program_without_new_line.py deleted file mode 100644 index 67dccc1..0000000 --- a/python_program_without_new_line.py +++ /dev/null @@ -1,10 +0,0 @@ -# print each statement on a new line -print("Python") -print("is easy to learn.") - -# new line -print() - -# print both the statements on a single line -print("Python", end=" ") -print("is easy to learn.") \ No newline at end of file diff --git a/queue using list.py b/queue using list.py deleted file mode 100644 index 923144d..0000000 --- a/queue using list.py +++ /dev/null @@ -1,22 +0,0 @@ -# 6-12-22 -# queue using list -# create a empty queue -queue = [] -# Adding elements to the queue -queue.append('b') -queue.append('j') -queue.append('s') -queue.append('a') -queue.append('r') - -print("initialqueue") -print(queue) - -# pop the element into the queue by using FIFO' -print("\nElements dequeued from queue") -print(queue.pop(0)) -print(queue.pop(0)) -print(queue.pop(0)) - -print("\nQueue after removing elements") -print(queue) \ No newline at end of file diff --git a/queue_using_collections_of_deque.py b/queue_using_collections_of_deque.py deleted file mode 100644 index 2102703..0000000 --- a/queue_using_collections_of_deque.py +++ /dev/null @@ -1,22 +0,0 @@ -# 6-12-22 -#queue using collections of deque -from collections import deque -#creating empty deque -queue = deque() -# adding element to the queue -queue.append('a') -queue.append('b') -queue.append('c') - - -print("initial queue") -print(queue) - -# popleft the element into the queue by using FIFO -print("\nElements dequeued from the queue") -print(queue.popleft()) -print(queue.popleft()) -print(queue.popleft()) - -print("\nQueue after removing elements") -print(queue) \ No newline at end of file diff --git a/quick_sort.py b/quick_sort.py deleted file mode 100644 index be2e9e2..0000000 --- a/quick_sort.py +++ /dev/null @@ -1,55 +0,0 @@ -# 22-12-22 -# quick sort -# Function to find the partition position -def partition(array, low, high): - # choose the rightmost element as pivot - pivot = array[high] - - # pointer for greater element - i = low - 1 - - # traverse through all elements - # compare each element with pivot - for j in range(low, high): - if array[j] <= pivot: - # If element smaller than pivot is found - # swap it with the greater element pointed by i - i = i + 1 - - # Swapping element at i with element at j - (array[i], array[j]) = (array[j], array[i]) - - # Swap the pivot element with the greater element specified by i - (array[i + 1], array[high]) = (array[high], array[i + 1]) - - # Return the position from where partition is done - return i + 1 - - -# function to perform quicksort - - -def quickSort(array, low, high): - if low < high: - # Find pivot element such that - # element smaller than pivot are on the left - # element greater than pivot are on the right - pi = partition(array, low, high) - - # Recursive call on the left of pivot - quickSort(array, low, pi - 1) - - # Recursive call on the right of pivot - quickSort(array, pi + 1, high) - - -data = [1, 7, 4, 1, 10, 9, 2] -print("Unsorted Array") -print(data) - -size = len(data) - -quickSort(data, 0, size - 1) - -print('Sorted Array in Ascending Order:') -print(data) diff --git a/quick_sort_ex.py b/quick_sort_ex.py deleted file mode 100644 index e928908..0000000 --- a/quick_sort_ex.py +++ /dev/null @@ -1,33 +0,0 @@ -# 23-12-22 -# quick sort example -def QuickSort(arr): - elements = len(arr) - - # Base case - if elements < 2: - return arr - - current_position = 0 # Position of the partitioning element - - for i in range(1, elements): # Partitioning loop - if arr[i] <= arr[0]: - current_position += 1 - temp = arr[i] - arr[i] = arr[current_position] - arr[current_position] = temp - - temp = arr[0] - arr[0] = arr[current_position] - arr[current_position] = temp # Brings pivot to it's appropriate position - - left = QuickSort(arr[0:current_position]) # Sorts the elements to the left of pivot - right = QuickSort(arr[current_position + 1:elements]) # sorts the elements to the right of pivot - - arr = left + [arr[current_position]] + right # Merging everything together - - return arr - - -array_to_be_sorted = [4, 2, 7, 3, 1, 6] -print("Original Array: ", array_to_be_sorted) -print("Sorted Array: ", QuickSort(array_to_be_sorted)) \ No newline at end of file diff --git a/quick_sort_ex1.py b/quick_sort_ex1.py deleted file mode 100644 index 4117f8a..0000000 --- a/quick_sort_ex1.py +++ /dev/null @@ -1,36 +0,0 @@ -# 24-12-22 -# quick sort example1 - -def quick_sort(alist, start, end): - # Sorts the list from indexes start to end - 1 inclusive - if end - start > 1: - p = partition(alist, start, end) - quick_sort(alist, start, p) - quick_sort(alist, p + 1, end) - - -def partition(alist, start, end): - pivot = alist[start] - i = start + 1 - j = end - 1 - - while True: - while (i <= j and alist[i] <= pivot): - i = i + 1 - while (i <= j and alist[j] >= pivot): - j = j - 1 - - if i <= j: - alist[i], alist[j] = alist[j], alist[i] - else: - alist[start], alist[j] = alist[j], alist[start] - return j - - -# input list -alist = [1, 74, 96, 5, 42, 63] -print('Input List\n', alist) - -# sort list -quick_sort(alist, 0, len(alist)) -print('Sorted List\n', alist) \ No newline at end of file diff --git a/quick_sort_example.py b/quick_sort_example.py deleted file mode 100644 index b00260b..0000000 --- a/quick_sort_example.py +++ /dev/null @@ -1,33 +0,0 @@ -# 22-12-22 -# quick sort example -# divide function -def partition(arr, low, high): - i = (low - 1) - pivot = arr[high] # pivot element - for j in range(low, high): - # If current element is smaller - if arr[j] <= pivot: - # increment - i = i + 1 - arr[i], arr[j] = arr[j], arr[i] - arr[i + 1], arr[high] = arr[high], arr[i + 1] - return (i + 1) - - -# sort -def quickSort(arr, low, high): - if low < high: - # index - pi = partition(arr, low, high) - # sort the partitions - quickSort(arr, low, pi - 1) - quickSort(arr, pi + 1, high) - - -# main -arr = [2, 5, 3, 8, 6, 5, 4, 7] -n = len(arr) -quickSort(arr, 0, n - 1) -print("Sorted array is:") -for i in range(n): - print(arr[i], end=" ") diff --git a/quick_sort_using_list.py b/quick_sort_using_list.py deleted file mode 100644 index 8e31e0e..0000000 --- a/quick_sort_using_list.py +++ /dev/null @@ -1,33 +0,0 @@ -# 23-12-22 -# quick sort using list -def quicksort(list, start, end): - # Sorts the list from indexes start to end - 1 - if end - start > 1: - p = partition(list, start, end) - quicksort(list, start, p) - quicksort(list, p + 1, end) - - -def partition(list, start, end): - pivot = list[start] - i = start + 1 - j = end - 1 - - while True: - while i <= j and list[i] <= pivot: - i = i + 1 - while i <= j and list[j] >= pivot: - j = j - 1 - - if i <= j: - list[i], list[j] = list[j], list[i] - else: - list[start], list[j] = list[j], list[start] - return j - - -list = input('Enter the list of numbers: ').split() -list = [int(x) for x in list] -quicksort(list, 0, len(list)) -print('Sorted list: ', end='') -print(list) \ No newline at end of file diff --git a/random_number.py b/random_number.py deleted file mode 100644 index 5f871da..0000000 --- a/random_number.py +++ /dev/null @@ -1,4 +0,0 @@ -# program to generate a random number between 0 and 9 -# importing the random module -import random -print(random.randint(0,9)) \ No newline at end of file diff --git a/range_function.py b/range_function.py deleted file mode 100644 index 15709aa..0000000 --- a/range_function.py +++ /dev/null @@ -1,3 +0,0 @@ -r = reverse(50) -for i in r: - print(i) \ No newline at end of file diff --git a/relational_operators.py b/relational_operators.py deleted file mode 100644 index 370ac69..0000000 --- a/relational_operators.py +++ /dev/null @@ -1,16 +0,0 @@ -a=1; b=2 -if(a>=b): - print("yes") -else: - print("no") - - - - - - - - - - - diff --git a/remove_punctuation_as_string.py b/remove_punctuation_as_string.py deleted file mode 100644 index d59e95c..0000000 --- a/remove_punctuation_as_string.py +++ /dev/null @@ -1,18 +0,0 @@ -# define punctuation -punctuations = '''!()-[]{};:'"\,<>./?@#$%^&*_~''' - -my_str = "Hello!!!, he said ---and went." - -# To take input from the user -# my_str = input("Enter a string: ") - -# remove punctuation from the string -no_punct = "" -for char in my_str: - if char not in punctuations: - no_punct = no_punct + char - - # display the unpunctuated string - print(no_punct) - - diff --git a/reverse_while_loop.py b/reverse_while_loop.py deleted file mode 100644 index bde1efe..0000000 --- a/reverse_while_loop.py +++ /dev/null @@ -1,6 +0,0 @@ -# 2-2-23 -# to print numbers in reverse order -i = 10 -while i >= 0: - print(i, end=' ') - i = i - 1 diff --git a/scoping_program.py b/scoping_program.py deleted file mode 100644 index 2f0b4e2..0000000 --- a/scoping_program.py +++ /dev/null @@ -1,7 +0,0 @@ -# Scoping -i=1 -def f(): - i=5 -print(i',in f()') -print(i,global') -fun() diff --git a/selection_sort.py b/selection_sort.py deleted file mode 100644 index 84a8a03..0000000 --- a/selection_sort.py +++ /dev/null @@ -1,29 +0,0 @@ -# 17-12-22 -# selection sort -def selection_sort(array): - # loop from the beginning of the array to the second to last item - currentIndex = 0 - while (currentIndex < len(array) - 1): - # save a copy of the currentIndex - minIndex = currentIndex - # loop through all indexes that proceed the currentIndex - i = currentIndex + 1 - while (i < len(array)): - # if the value of the index of the current loop is less - # than the value of the item at minIndex, update minIndex - # with the new lowest value index - if (array[i] < array[minIndex]): - # update minIndex with the new lowest value index - minIndex = i - i += 1 - # if minIndex has been updated, swap the values at minIndex and currentIndex - if (minIndex != currentIndex): - temp = array[currentIndex] - array[currentIndex] = array[minIndex] - array[minIndex] = temp - currentIndex += 1 - -if __name__ == '__main__': - array = [12, 11, 15, 10, 9, 1, 2, 3, 13, 14, 4, 5, 6, 7, 8] - selection_sort(array) - print(array) \ No newline at end of file diff --git a/selection_sort_example.py b/selection_sort_example.py deleted file mode 100644 index 243d973..0000000 --- a/selection_sort_example.py +++ /dev/null @@ -1,31 +0,0 @@ -# 16-12-2022 -# selection sort example -def selection(a): # Function to implement selection sort - for i in range(len(a)): # Traverse through all array elements - small = i # minimum element in unsorted array - for j in range(i + 1, len(a)): - if a[small] > a[j]: - small = j - # Swap the found minimum element with - # the first element - a[i], a[small] = a[small], a[i] - - -def printArr(a): # function to print the array - - for i in range(len(a)): - print(a[i], end=" ") - - -a = [10, 2, 5, 8, 6, 11, 25, 1] -print("Before sorting array elements are - ") -printArr(a) -selection(a) -print("\nAfter sorting array elements are - ") -selection(a) -printArr(a) - - - - - diff --git a/selectionsort.py b/selectionsort.py deleted file mode 100644 index 60f0d57..0000000 --- a/selectionsort.py +++ /dev/null @@ -1,22 +0,0 @@ -# 16-12-2022 -# selection sort -def selectionSort(array, size): - for step in range(size): - min_idx = step - - for i in range(step + 1, size): - - # to sort in descending order, change > to < in this line - # select the minimum element in each loop - if array[i] < array[min_idx]: - min_idx = i - - # put min at the correct position - (array[step], array[min_idx]) = (array[min_idx], array[step]) - - -data = [2, 45, 0, 11, 9] -size = len(data) -selectionSort(data, size) -print('Sorted Array in Ascending Order:') -print(data) \ No newline at end of file diff --git a/set.py b/set.py deleted file mode 100644 index d3d23b6..0000000 --- a/set.py +++ /dev/null @@ -1,23 +0,0 @@ -# 10-1-23 -# set -# A Python program to -# demonstrate adding elements - - -# Creating a Set -people = {"Jay", "Jalpa", "Anjali"} - -print("People:", end=" ") -print(people) - -# This will add Suman -# in the set -people.add("Suman") - -# Adding elements to the -# set using iterator -for i in range(1, 6): - people.add(i) - -print("\nSet after adding element:", end=" ") -print(people) diff --git a/set1.py b/set1.py deleted file mode 100644 index 97378f6..0000000 --- a/set1.py +++ /dev/null @@ -1,8 +0,0 @@ -# 11-1-23 -# set another program -Days = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"} -print(Days) -print(type(Days)) -print("Looping through the set elements ... ") -for i in Days: - print(i) diff --git a/set_ex1.py b/set_ex1.py deleted file mode 100644 index 618aade..0000000 --- a/set_ex1.py +++ /dev/null @@ -1,10 +0,0 @@ -# 11-01-22 -# set example 1 -months = {"January", "February", "March", "April", "May", "June"} -print("\nprinting the original set ... ") -print(months) -print("\nRemoving some months from the set...") -months.remove("January") -months.remove("May") -print("\nPrinting the modified set...") -print(months) diff --git a/set_example.py b/set_example.py deleted file mode 100644 index 3bd31d5..0000000 --- a/set_example.py +++ /dev/null @@ -1,28 +0,0 @@ -# 10-1-23 -# set programs -# Python program to -# demonstrate intersection -# of two sets - -set1 = set() -set2 = set() - -for i in range(5): - set1.add(i) - -for i in range(3, 9): - set2.add(i) - -# Intersection using -# intersection() function -set3 = set1.intersection(set2) - -print("Intersection using intersection() function") -print(set3) - -# Intersection using -# "&" operator -set3 = set1 & set2 - -print("\nIntersection using '&' operator") -print(set3) diff --git a/set_program.py b/set_program.py deleted file mode 100644 index bdfc0f6..0000000 --- a/set_program.py +++ /dev/null @@ -1,3 +0,0 @@ -#set program -s={10,20,30,40,50} -print(s) \ No newline at end of file diff --git a/shell.py b/shell.py deleted file mode 100644 index f40a71f..0000000 --- a/shell.py +++ /dev/null @@ -1 +0,0 @@ -sort \ No newline at end of file diff --git a/shell_sort.py b/shell_sort.py deleted file mode 100644 index 2b64eb7..0000000 --- a/shell_sort.py +++ /dev/null @@ -1,22 +0,0 @@ -# 25-12-2022 -def shellSort(array, n): - - # Rearrange elements at each n/2, n/4, n/8, ... intervals - interval = n // 2 - while interval > 0: - for i in range(interval, n): - temp = array[i] - j = i - while j >= interval and array[j - interval] > temp: - array[j] = array[j - interval] - j -= interval - - array[j] = temp - interval //= 2 - - -data = [9, 8, 3, 7, 5, 6, 4, 1] -size = len(data) -shellSort(data, size) -print('Sorted Array in Ascending Order:') -print(data) \ No newline at end of file diff --git a/shell_sort_ex1.py b/shell_sort_ex1.py deleted file mode 100644 index 710f171..0000000 --- a/shell_sort_ex1.py +++ /dev/null @@ -1,24 +0,0 @@ -# 27-12-22 -# shell sort example 1 -from math import floor - - -def shellSort(arr): - n = len(arr) - # Gap sequence - gap = floor(n / 2) - while gap > 0: - for i in range(gap, n): - temp = arr[i] - j = i - # Compare elements at equal gap. - while j >= gap and temp < arr[j - gap]: - arr[j] = arr[j - gap] - j -= gap - arr[j] = temp - gap = floor(gap / 2) - - -arr = [3, 2, 1, 4, 6, 9, 5, 10, 0] -shellSort(arr) -print(arr) diff --git a/shell_sort_example.py b/shell_sort_example.py deleted file mode 100644 index c89ec31..0000000 --- a/shell_sort_example.py +++ /dev/null @@ -1,37 +0,0 @@ -# 25-12-22 -# shell-sort example - - -def shellSort(arr, n): - # code here - gap = n // 2 - - while gap > 0: - j = gap - # Check the array in from left to right - # Till the last possible index of j - while j < n: - i = j - gap # This will keep help in maintain gap value - - while i >= 0: - # If value on right side is already greater than left side value - # We don't do swap else we swap - if arr[i + gap] > arr[i]: - - break - else: - arr[i + gap], arr[i] = arr[i], arr[i + gap] - - i = i - gap # To check left side also - # If the element present is greater than current element - j += 1 - gap = gap // 2 - - -# driver to check the code -arr2 = [12, 34, 54, 2, 3] -print("input array:", arr2) - -shellSort(arr2, len(arr2)) -print("sorted array", arr2) - diff --git a/shell_sort_using_array.py b/shell_sort_using_array.py deleted file mode 100644 index a3ec779..0000000 --- a/shell_sort_using_array.py +++ /dev/null @@ -1,22 +0,0 @@ -# 26-12-22 -def shell_sort(array, n): - h = n // 2 - while h > 0: - for i in range(h, n): - t = array[i] - j = i - while j >= h and array[j - h] > t: - array[j] = array[j - h] - j -= h - - array[j] = t - h = h // 2 - - -array = [34, 12, 20, 7, 13, 15, 2, 23] -n = len(array) -print('Array before Sorting:') -print(array) -shell_sort(array, n) -print('Array after Sorting:') -print(array) \ No newline at end of file diff --git a/shell_sort_using_list.py b/shell_sort_using_list.py deleted file mode 100644 index cdd7432..0000000 --- a/shell_sort_using_list.py +++ /dev/null @@ -1,18 +0,0 @@ -# 26-12-22 -# shell sort list -def ShellSort(array): - inter = len(array) // 2 - while inter >= 1: - i = 0 - while i < inter: - j = i + inter - while j < len(array): - if array[j] < array[j - inter]: - array[j], array[j - inter] = array[j - inter], array[j] - j = j + inter - i = i + 1 - inter = inter // 2 - -array1 = [8, 9, 2, 0, 7, 1, 6, 4, 3, 5] -ShellSort(array1) -print(array1) \ No newline at end of file diff --git a/simple_variable_program.py b/simple_variable_program.py deleted file mode 100644 index b9bc381..0000000 --- a/simple_variable_program.py +++ /dev/null @@ -1,5 +0,0 @@ -#simple assignment of variable -a=2 -b=3 -area=a*(b**3) -print(area) \ No newline at end of file diff --git a/slicing_in_a_list.py b/slicing_in_a_list.py deleted file mode 100644 index cf99c17..0000000 --- a/slicing_in_a_list.py +++ /dev/null @@ -1,14 +0,0 @@ -# 5-01-23 -# slicing using a list -# List slicing in Python - -my_list = ['I', 'Love', 'Python', 'Programming', 'Language'] - -# items from index 2 to index 3 -print(my_list[2:4]) - -# items from index 4 to end -print(my_list[4:]) - -# items beginning to end -print(my_list[:]) \ No newline at end of file diff --git a/sort_words.py b/sort_words.py deleted file mode 100644 index 1b8289f..0000000 --- a/sort_words.py +++ /dev/null @@ -1,17 +0,0 @@ -# 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) \ No newline at end of file diff --git a/student_result.py b/student_result.py deleted file mode 100644 index 5a81c94..0000000 --- a/student_result.py +++ /dev/null @@ -1,14 +0,0 @@ -Grade=65 -if Grade>=90: - print("A Grade") -elif Grade>=80: - print("B Grade") -elif Grade>=70: - print("C Grade") -elif Grade>=65: - print("D grade") -else: - print("Falling Grade") - - - \ No newline at end of file diff --git a/swap_elements_using_list.py b/swap_elements_using_list.py deleted file mode 100644 index a98f83f..0000000 --- a/swap_elements_using_list.py +++ /dev/null @@ -1,13 +0,0 @@ -# 11-2-23 -# swap elements using list -# Swap function -def swapPositions(list, pos1, pos2): - list[pos1], list[pos2] = list[pos2], list[pos1] - return list - - -# Driver function -List = [23, 65, 19, 90] -pos1, pos2 = 1, 3 - -print(swapPositions(List, pos1 - 1, pos2 - 1)) diff --git a/swap_two_variables.py b/swap_two_variables.py deleted file mode 100644 index ac7a229..0000000 --- a/swap_two_variables.py +++ /dev/null @@ -1,6 +0,0 @@ -s=15 -j=20 - -s,j=j,s -print("s=",s) -print("j=",j) diff --git a/swapping_two_variables.py b/swapping_two_variables.py deleted file mode 100644 index f7d62d8..0000000 --- a/swapping_two_variables.py +++ /dev/null @@ -1,16 +0,0 @@ -# python program to swap two vribles - -x=5 -y=10 - -# to tke inputs from the user -#x= input('Enter vlue of x:) -#y= input('Enter value of y:) - -#create temporry varible nd swap the values -temp=x -x=y -y=temp - -print(' The value of x after swapping:{}'.format(x)) -print('the value of y after swpping:{}'.format(y)) \ No newline at end of file diff --git a/the_while_loop.py b/the_while_loop.py deleted file mode 100644 index 9713cfa..0000000 --- a/the_while_loop.py +++ /dev/null @@ -1,10 +0,0 @@ -#To Display Even Numbers Between M and N -m,n=[int(i) for i in input("enter minimum and maximum range:").split(',')] -x=m #Start From M Onwards -if x % 2!=0: #If x is not even,start from next number - x=x+1 -while x>=m and x<=n: - print(x) - x+=2 - - diff --git a/tree_traversal.py b/tree_traversal.py deleted file mode 100644 index 10dbde8..0000000 --- a/tree_traversal.py +++ /dev/null @@ -1,76 +0,0 @@ -# 27-12-22 -# tree traversal -class Node: - def __init__(self, item): - self.left = None - self.right = None - self.val = item - - -def inorder(root): - - if root: - # Traverse left - inorder(root.left) - # Traverse root - print(str(root.val) + "->", end='') - # Traverse right - inorder(root.right) - - -def postorder(root): - - if root: - # Traverse left - postorder(root.left) - # Traverse right - postorder(root.right) - # Traverse root - print(str(root.val) + "->", end='') - - -def preorder(root): - - if root: - # Traverse root - print(str(root.val) + "->", end='') - # Traverse left - preorder(root.left) - # Traverse right - preorder(root.right) - - -root = Node(1) -root.left = Node(2) -root.right = Node(3) -root.left.left = Node(4) -root.left.right = Node(5) - -print("Inorder traversal ") -inorder(root) - -print("\nPreorder traversal ") -preorder(root) - -print("\nPostorder traversal ") -postorder(root) - - - - - - - - - - - - - - - - - - - - diff --git a/tuple_ex.py b/tuple_ex.py deleted file mode 100644 index 8c37170..0000000 --- a/tuple_ex.py +++ /dev/null @@ -1,12 +0,0 @@ -# 8-1-22 -# tuple example -names = ('Jay', 'Anjali', 'Jalpa', 'Yash') -print(names[0]) # prints 'Jay' -print(names[1]) # prints 'Anjali' -print(names[2]) # prints 'Jalpa' -print(names[3]) # prints 'Yash' - -nums = (1, 2, 3, 4, 5) -print(nums[0]) # prints 1 -print(nums[1]) # prints 2 -print(nums[4]) # prints 5 diff --git a/tuple_ex1.py b/tuple_ex1.py deleted file mode 100644 index d997d8f..0000000 --- a/tuple_ex1.py +++ /dev/null @@ -1,11 +0,0 @@ -# 9-1-22 -# tuple example -def my_fun(): - name = 'John' - ID = 23567 - Title = 'Software Engineer' - return name, ID, Title - - -employee = my_fun() -print('Employee detail is:', employee) diff --git a/unary_minas_operator.py b/unary_minas_operator.py deleted file mode 100644 index 20ec9ad..0000000 --- a/unary_minas_operator.py +++ /dev/null @@ -1,6 +0,0 @@ -#unary minas operator -n=10 -print(-n)# displays -10 -num=-10 -num=-num -print(num) \ No newline at end of file diff --git a/uppercase_and_lowercase_program.py b/uppercase_and_lowercase_program.py deleted file mode 100644 index 6f2a5a8..0000000 --- a/uppercase_and_lowercase_program.py +++ /dev/null @@ -1,4 +0,0 @@ -name="believe in yourself" -name="dreams comes true" -print(name.upper()) -print(name.lower()) diff --git a/using_variable_in_string.py b/using_variable_in_string.py deleted file mode 100644 index a9073b1..0000000 --- a/using_variable_in_string.py +++ /dev/null @@ -1,4 +0,0 @@ -first_name="Jay" -last_name="Simaria" -full_name=f"{first_name} {last_name}" -print(full_name) \ No newline at end of file diff --git a/while_loop.py b/while_loop.py deleted file mode 100644 index a41a747..0000000 --- a/while_loop.py +++ /dev/null @@ -1,11 +0,0 @@ -# 31-1-2023 -# print any 5 numbers using while loop - -# initialize the variable -i = 1 -n = 5 - -# while loop from i = 1 to 5 -while i <= n: - print(i) - i = i + 1 diff --git a/while_loop_ex.py b/while_loop_ex.py deleted file mode 100644 index 4465473..0000000 --- a/while_loop_ex.py +++ /dev/null @@ -1,8 +0,0 @@ -# 1-2-23 -# print any 5 variable using while loop -num = 0 -while num <= 10: - num += 1 - if num % 2 != 0: - continue - print(num) diff --git a/while_loop_ex1.py b/while_loop_ex1.py deleted file mode 100644 index adbe737..0000000 --- a/while_loop_ex1.py +++ /dev/null @@ -1,7 +0,0 @@ -# 1-2-23 -# to print reverse string -while True: - word = input('Enter a string and I will print it backwards(type q to quit): ') - if word == 'q': - break - print(word[::-1]) \ No newline at end of file diff --git a/while_loop_example.py b/while_loop_example.py deleted file mode 100644 index a455697..0000000 --- a/while_loop_example.py +++ /dev/null @@ -1,8 +0,0 @@ -# 31-1-23 -# to print odd number in the range of 1 to 20 while using while loop -i = 0 -while i <= 20: - i += 1 - if i % 2 == 1: - continue - print(i) diff --git a/while_loop_using_else_statement.py b/while_loop_using_else_statement.py deleted file mode 100644 index 982aa31..0000000 --- a/while_loop_using_else_statement.py +++ /dev/null @@ -1,8 +0,0 @@ -# 2-2-23 -# to check any numbers is less than 10 -value = 0 -while value < 10: - print(value, " is smaller than 10") - value = value + 1 -else: # executes once the condition in the while loop turns false - print(value, " is equal to 10") diff --git a/whitespaces_to_string_with_tabs_or_nunbers.py b/whitespaces_to_string_with_tabs_or_nunbers.py deleted file mode 100644 index 3c08b72..0000000 --- a/whitespaces_to_string_with_tabs_or_nunbers.py +++ /dev/null @@ -1,2 +0,0 @@ -print("\n\tpython was developed by guido van rossum""\n\tpython sourcecode is available in gui") -print("languages:\nC\nC++\nJava\nJ2ee\nPython\nAdvPython\nMachineLearning\nDataScience\nRuby") \ No newline at end of file