├── .idea ├── Videos.iml ├── inspectionProfiles │ ├── Project_Default.xml │ └── profiles_settings.xml ├── markdown-navigator │ └── profiles_settings.xml ├── misc.xml ├── modules.xml └── vcs.xml ├── InterviewPrep ├── ThanksForWatching.py ├── backspace.py ├── deckOfCards.py ├── deleteReoccuringCharacters.py ├── fizzBuzz.py ├── linkedListMiddleElement.py ├── longestCommonPrefix.py ├── unique.py └── vowelSwap.py ├── Introductions ├── linkedListFullClass.py └── linkedListOnlyNodes.py ├── Projects └── weatherTutorial.py └── README.md /.idea/Videos.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 12 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /.idea/markdown-navigator/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /InterviewPrep/ThanksForWatching.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | def ThanksForWatching(): 4 | print "Give us a Like!" 5 | print "Subscribe!" 6 | print "Link to the code on Github" 7 | 8 | -------------------------------------------------------------------------------- /InterviewPrep/backspace.py: -------------------------------------------------------------------------------- 1 | def backspace(inputString): 2 | myStack = [] 3 | for char in inputString: 4 | if char != '<': 5 | myStack.append(char) 6 | else: 7 | myStack.pop() 8 | return ''.join(myStack) 9 | 10 | 11 | inp = "aa node2 , "3" -> "7" 25 | node2.nextNode = node3 # node2 -> node3 , "7" -> "10" 26 | 27 | # 3->7->10 28 | 29 | print getMiddleElement(node1) 30 | 31 | -------------------------------------------------------------------------------- /InterviewPrep/longestCommonPrefix.py: -------------------------------------------------------------------------------- 1 | def longestCommonPrefix(strs): 2 | if len(strs) < 1: 3 | return "" 4 | currentPrefix = strs[0] 5 | for string in strs: 6 | tempString = "" 7 | minLen = min(len(currentPrefix), len(string)) 8 | if len(string) < 1: 9 | return "" 10 | for i in range(minLen): 11 | if currentPrefix[i] == string[i]: 12 | tempString += string[i] 13 | if minLen - 1 == i: 14 | currentPrefix = tempString 15 | else: 16 | currentPrefix = tempString 17 | break 18 | return currentPrefix 19 | 20 | 21 | strs = ["aaabbb","aaabcc","aaab","aaabbbfffeee"] 22 | print longestCommonPrefix(strs) -------------------------------------------------------------------------------- /InterviewPrep/unique.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | def findUniqueElements(array): 4 | mySet = set() 5 | for element in array: 6 | mySet.add(element) 7 | return len(mySet) -------------------------------------------------------------------------------- /InterviewPrep/vowelSwap.py: -------------------------------------------------------------------------------- 1 | def isVowel(character): 2 | vowels = "aeiou" 3 | if character in vowels: 4 | return True 5 | return False 6 | 7 | def vowelSwap(inp): 8 | 9 | # Setting up our pointers and our swap map 10 | inputLength = len(inp) 11 | leftPointer = 0 12 | rightPointer = inputLength - 1 13 | swapMap = {} 14 | 15 | while leftPointer <= rightPointer: 16 | 17 | # Checking if the left pointer value is not a vowel 18 | if not isVowel(inp[leftPointer]): 19 | # If it's not, increment the pointer and continue 20 | leftPointer += 1 21 | continue 22 | 23 | # Checking if the right pointer value is not a vowel 24 | if not isVowel(inp[rightPointer]): 25 | # If it's not, increment the pointer and continue 26 | rightPointer -= 1 27 | continue 28 | 29 | 30 | # This only runs when both pointers are at a vowel 31 | # Recording the swap 32 | swapMap[leftPointer] = inp[rightPointer] 33 | swapMap[rightPointer] = inp[leftPointer] 34 | 35 | # Moving pointers to the next value after the swap 36 | leftPointer += 1 37 | rightPointer -= 1 38 | 39 | # Create the new string with the swapped vowels 40 | swappedString = "" 41 | for i in range(inputLength): 42 | if isVowel(inp[i]): 43 | swappedString += swapMap[i] 44 | else: 45 | swappedString += inp[i] 46 | 47 | # Return the vowel swapped String 48 | return swappedString 49 | 50 | inputString = "united states" 51 | print vowelSwap(inputString) 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /Introductions/linkedListFullClass.py: -------------------------------------------------------------------------------- 1 | class linkedListNode: 2 | def __init__(self, value, nextNode=None): 3 | self.value = value 4 | self.nextNode = nextNode 5 | 6 | 7 | class linkedList: 8 | def __init__(self, head=None): 9 | self.head = head 10 | 11 | def insert(self, value): 12 | node = linkedListNode(value) 13 | if self.head is None: 14 | self.head = node 15 | return 16 | 17 | currentNode = self.head 18 | while True: 19 | if currentNode.nextNode is None: 20 | currentNode.nextNode = node 21 | break 22 | currentNode = currentNode.nextNode 23 | 24 | def printLinkedList(self): 25 | currentNode = self.head 26 | while currentNode is not None: 27 | print currentNode.value, "->", 28 | currentNode = currentNode.nextNode 29 | print "None" 30 | 31 | 32 | 33 | 34 | ll = linkedList() 35 | ll.printLinkedList() 36 | ll.insert("3") 37 | ll.printLinkedList() 38 | ll.insert("44") 39 | ll.printLinkedList() 40 | ll.insert("55") 41 | ll.printLinkedList() -------------------------------------------------------------------------------- /Introductions/linkedListOnlyNodes.py: -------------------------------------------------------------------------------- 1 | # Nodes 2 | # 1. Value - anything strings, integers, objects 3 | # 2. The Next Node 4 | 5 | 6 | class linkedListNode: 7 | def __init__(self, value, nextNode=None): 8 | self.value = value 9 | self.nextNode = nextNode 10 | 11 | 12 | def insertNode(head, valuetoInsert): 13 | currentNode = head 14 | while currentNode is not None: 15 | if currentNode.nextNode is None: 16 | currentNode.nextNode = linkedListNode(valuetoInsert) 17 | return head 18 | currentNode = currentNode.nextNode 19 | 20 | # Delete node function 21 | def deleteNode(head, valueToDelete): 22 | currentNode = head 23 | previousNode = None 24 | while currentNode is not None: 25 | if currentNode.value == valueToDelete: 26 | if previousNode is None: 27 | newHead = currentNode.nextNode 28 | currentNode.nextNode = None 29 | return newHead 30 | previousNode.nextNode = currentNode.nextNode 31 | return head 32 | previousNode = currentNode 33 | currentNode = currentNode.nextNode 34 | return head # Value to delete was not found. 35 | 36 | 37 | # "3" -> "7" -> "10" 38 | 39 | node1 = linkedListNode("3") # "3" 40 | node2 = linkedListNode("7") # "7" 41 | node3 = linkedListNode("10") # "10" 42 | 43 | node1.nextNode = node2 # node1 -> node2 , "3" -> "7" 44 | node2.nextNode = node3 # node2 -> node3 , "7" -> "10" 45 | 46 | # node1 -> node2 -> node3 47 | 48 | head = node1 49 | print "*********************************" 50 | print "Traversing the regular linkedList" 51 | print "*********************************" 52 | # Regular Traversal 53 | currentNode = head 54 | while currentNode is not None: 55 | print currentNode.value, 56 | currentNode = currentNode.nextNode 57 | print '' 58 | print "*********************************" 59 | 60 | 61 | 62 | print "deleting the node '7'" 63 | newHead = deleteNode(head, "10") 64 | 65 | 66 | print "*********************************" 67 | print "traversing the new linkedList with the node 7 removed" 68 | print "*********************************" 69 | 70 | 71 | currentNode = newHead 72 | while currentNode is not None: 73 | print currentNode.value, 74 | currentNode = currentNode.nextNode 75 | 76 | 77 | print '' 78 | print "*********************************" 79 | print "Inserting the node '99'" 80 | newHead = insertNode(newHead, "99") 81 | 82 | 83 | print "*********************************" 84 | print "traversing the new linkedList with the node 99 added" 85 | print "*********************************" 86 | 87 | 88 | currentNode = newHead 89 | while currentNode is not None: 90 | print currentNode.value, 91 | currentNode = currentNode.nextNode -------------------------------------------------------------------------------- /Projects/weatherTutorial.py: -------------------------------------------------------------------------------- 1 | import urllib 2 | import json 3 | 4 | api_endpoint = "http://api.openweathermap.org/data/2.5/weather" 5 | 6 | #change this to city = "Toronto" or any specific place if you don't want to input it 7 | city = raw_input() 8 | 9 | # Replace with your API KEY 10 | apikey = "xxxReplace With Your Api Keyxxx" 11 | 12 | # Put all the components of the URL together 13 | url = api_endpoint + "?q=" + city + "&appid=" + apikey 14 | 15 | response = urllib.urlopen(url) 16 | parseResponse = json.loads(response.read()) 17 | 18 | temperature = parseResponse['main']['temp'] 19 | weather = parseResponse['weather'][0]['description'] 20 | 21 | print temperature 22 | print weather -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hey there! 2 | 3 | This repository contains code from the YouTube videos I've done! 4 | 5 | Check out the youtube channel! 6 | 7 | https://www.youtube.com/channel/UCoYzQqZNCRqqAomJwJ6yEdg?view_as=subscriber 8 | --------------------------------------------------------------------------------