From be26cc5c5c00b30160f390533fc633ca5d7c45c3 Mon Sep 17 00:00:00 2001 From: Omkar Pathak Date: Tue, 5 Nov 2019 11:27:24 +0530 Subject: [PATCH 01/13] Added github actions --- .github/workflows/pythonapp.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/pythonapp.yml diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml new file mode 100644 index 0000000..52a8b87 --- /dev/null +++ b/.github/workflows/pythonapp.yml @@ -0,0 +1,29 @@ +name: Python application + +on: [push, pull_request] +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + - name: Lint with flake8 + run: | + pip install flake8 + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pip install pytest + pytest From aadc4546d4d22e47c105815f80095ca3b251dc7e Mon Sep 17 00:00:00 2001 From: Omkar Pathak Date: Tue, 5 Nov 2019 11:28:24 +0530 Subject: [PATCH 02/13] Update pythonapp.yml --- .github/workflows/pythonapp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 52a8b87..d01da42 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -15,7 +15,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt + # pip install -r requirements.txt - name: Lint with flake8 run: | pip install flake8 From d20faf6c77a8c94fe414655b6f306ea508e09cf6 Mon Sep 17 00:00:00 2001 From: Omkar Pathak Date: Tue, 5 Nov 2019 11:36:01 +0530 Subject: [PATCH 03/13] Fixed syntax changes --- CompetitiveProgramming/CodeChef/P36_SUBGCD.py | 12 ++++++------ .../Basics_Of_Input_Output/P04_PrimeNumber.py | 2 +- .../HackerEarth/DataStructures/Arrays/P11_JumpOut.py | 2 +- CompetitiveProgramming/SPOJ/P14_MUL.py | 4 ++-- Programs/P40_CipherText.py | 4 ---- Programs/P56_Pangram.py | 2 +- 6 files changed, 11 insertions(+), 15 deletions(-) diff --git a/CompetitiveProgramming/CodeChef/P36_SUBGCD.py b/CompetitiveProgramming/CodeChef/P36_SUBGCD.py index a4d503a..5087b84 100644 --- a/CompetitiveProgramming/CodeChef/P36_SUBGCD.py +++ b/CompetitiveProgramming/CodeChef/P36_SUBGCD.py @@ -60,11 +60,11 @@ def gcd(firstNumber, secondNumber): flag = 0 size = 0 for i in array: - currentGCD = gcd(i, currentGCD) - if currentGCD == 1: - flag = 1 - print(count) - break + currentGCD = gcd(i, currentGCD) + if currentGCD == 1: + flag = 1 + print(count) + break if flag == 0: - print(-1) + print(-1) \ No newline at end of file diff --git a/CompetitiveProgramming/HackerEarth/Basics_Of_Input_Output/P04_PrimeNumber.py b/CompetitiveProgramming/HackerEarth/Basics_Of_Input_Output/P04_PrimeNumber.py index c491dfd..9fa2418 100644 --- a/CompetitiveProgramming/HackerEarth/Basics_Of_Input_Output/P04_PrimeNumber.py +++ b/CompetitiveProgramming/HackerEarth/Basics_Of_Input_Output/P04_PrimeNumber.py @@ -15,7 +15,7 @@ import math userInput = int(input()) -if userInput>2 +if userInput > 2: print("2",end = ' ') for i in range(3, userInput + 2): check = 0 diff --git a/CompetitiveProgramming/HackerEarth/DataStructures/Arrays/P11_JumpOut.py b/CompetitiveProgramming/HackerEarth/DataStructures/Arrays/P11_JumpOut.py index 4da7dc1..acda653 100644 --- a/CompetitiveProgramming/HackerEarth/DataStructures/Arrays/P11_JumpOut.py +++ b/CompetitiveProgramming/HackerEarth/DataStructures/Arrays/P11_JumpOut.py @@ -27,7 +27,7 @@ array = input().split() array = [int(i) for i in array] array.insert(0,0) -count = +count = 0 for i in range(0, check + 1): pos = array[i] + i if pos > check: diff --git a/CompetitiveProgramming/SPOJ/P14_MUL.py b/CompetitiveProgramming/SPOJ/P14_MUL.py index e114106..735e492 100644 --- a/CompetitiveProgramming/SPOJ/P14_MUL.py +++ b/CompetitiveProgramming/SPOJ/P14_MUL.py @@ -1,5 +1,5 @@ t = int(input()) while t>0: t-=1 - n1, n2 = map(int, raw_input().split()) - print n1*n2 + n1, n2 = map(int, input().split()) + print(n1*n2) diff --git a/Programs/P40_CipherText.py b/Programs/P40_CipherText.py index af4b2c1..3733f43 100644 --- a/Programs/P40_CipherText.py +++ b/Programs/P40_CipherText.py @@ -12,8 +12,6 @@ def encrypt(message, key): num = LETTERS.find(chars) num += key encrypted += LETTERS[num] - else: - encrypted += symbol return encrypted @@ -25,8 +23,6 @@ def decrypt(message, key): num = LETTERS.find(chars) num -= key decrypted += LETTERS[num] - else: - decrypted += symbol return decrypted diff --git a/Programs/P56_Pangram.py b/Programs/P56_Pangram.py index 2e6ff3c..be2f31d 100644 --- a/Programs/P56_Pangram.py +++ b/Programs/P56_Pangram.py @@ -24,7 +24,7 @@ def pangram(sentence): # A short version of above function: def pangram2(sentence): alphabet = list(map(chr, range(97, 123))) - formattedString = ''.join(c for c in string if c.isalpha()).lower() + formattedString = ''.join(c for c in sentence if c.isalpha()).lower() return set(alphabet) == set(formattedString) if __name__ == '__main__': From 1cf984af807c090154556fdf023d8c13ef33b3f2 Mon Sep 17 00:00:00 2001 From: Omkar Pathak Date: Tue, 5 Nov 2019 11:38:11 +0530 Subject: [PATCH 04/13] Update pythonapp.yml --- .github/workflows/pythonapp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index d01da42..63612d1 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -26,4 +26,4 @@ jobs: - name: Test with pytest run: | pip install pytest - pytest + # pytest From 53f95064ee2302c9f2f26c01192e7e4a1e3e0ef1 Mon Sep 17 00:00:00 2001 From: Hanif Ali Date: Sun, 10 Nov 2019 07:25:12 +0500 Subject: [PATCH 05/13] Added Pretty Printing feature to Binary Tree Programs (#17) * Added some more functions to BinarySearchTree. -> Defining intial elements of newly created Trees -> Prettyprinting trees with left-right order and * representing null nodes. * Added pretty print to BinaryTree.py * Fixed flake8 Linting --- Programs/P43_BinarySearchTree.py | 23 ++++++++++++++++++++++- Programs/P62_BinaryTree.py | 21 +++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/Programs/P43_BinarySearchTree.py b/Programs/P43_BinarySearchTree.py index d82b433..eac303f 100644 --- a/Programs/P43_BinarySearchTree.py +++ b/Programs/P43_BinarySearchTree.py @@ -72,9 +72,13 @@ def postorder(self): print(str(self.data), end = ' ') class Tree(object): - def __init__(self): + def __init__(self, initial_data = []): self.root = None + # If provided, add initial data + for data in initial_data: + self.insert(data) + def insert(self, data): if self.root: return self.root.insert(data) @@ -106,6 +110,22 @@ def postorder(self): print('Postorder: ') self.root.postorder() + + def pprint(self, head_node=0, _pre="", _last=True, term=False): + + head_node = self.root if head_node == 0 else head_node + + data = "*" if head_node is None else head_node.data + + print(_pre, "`- " if _last else "|- ", data, sep="") + _pre += " " if _last else "| " + + if term: return + + for i, child in enumerate([head_node.leftChild, head_node.rightChild]): + self.pprint(child, _pre, bool(i) ,term=not(bool(child))) + + if __name__ == '__main__': tree = Tree() tree.insert(10) @@ -117,6 +137,7 @@ def postorder(self): tree.insert(7) tree.insert(15) tree.insert(13) + tree.pprint() print(tree.find(1)) print(tree.find(12)) tree.preorder() diff --git a/Programs/P62_BinaryTree.py b/Programs/P62_BinaryTree.py index fe29b3a..56a3bc1 100644 --- a/Programs/P62_BinaryTree.py +++ b/Programs/P62_BinaryTree.py @@ -38,18 +38,39 @@ def insertLeft(self,newnodeData): tree.left = self.left + + def printTree(tree): if tree != None: printTree(tree.getLeftChild()) print(tree.getnodeDataValue()) printTree(tree.getRightChild()) + +def pprint(head_node, _pre="", _last=True, term=False): + data = "*" if head_node is None else head_node.nodeData + + print(_pre, "`- " if _last else "|- ", data, sep="") + _pre += " " if _last else "| " + + if term: return + + left = head_node.getLeftChild() + right = head_node.getRightChild() + + for i, child in enumerate([left, right]): + pprint(child, _pre, bool(i) ,term=not(bool(child))) + + + + def testTree(): myTree = BinaryTree("1") myTree.insertLeft("2") myTree.insertRight("3") myTree.insertRight("4") printTree(myTree) + pprint(myTree) if __name__ == '__main__': testTree() From d968c4dcdf6f308b0276c74b796a9aaa6cbf46f7 Mon Sep 17 00:00:00 2001 From: Jayasree77 <41224416+Jayasree77@users.noreply.github.com> Date: Sun, 19 Apr 2020 19:51:11 +0530 Subject: [PATCH 06/13] Create Property_decoraters.py (#19) --- OOP/P11_Property decorators.py | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 OOP/P11_Property decorators.py diff --git a/OOP/P11_Property decorators.py b/OOP/P11_Property decorators.py new file mode 100644 index 0000000..2489bff --- /dev/null +++ b/OOP/P11_Property decorators.py @@ -0,0 +1,38 @@ +#This shows the usage of property decorators + +#Python @property is one of the built-in decorators. The main purpose of any decorator is to change your class methods or attributes in such a way so that the users neeed not make any additional changes in their code. + +#Without property decorators + +class BankAccount: + def __init__(self,name,balance): + self.name=name + self.balance=balance + self.total= self.name+ " has "+self.balance+ " dollars in the account" + +user1=BankAccount("Elon Musk","10000") +user1.name="Tim cook" +print(user1.name) +print(user1.total) + +# Output: Tim cook +# Elon Musk has 10000 dollars in the account + + +#With property decorators + +class BankAccount: + def __init__(self,name,balance): + self.name=name + self.balance=balance + @property + def total(self): + return self.name+ " has "+self.balance+ " dollars in the account" + +user1=BankAccount("Elon Musk","10000") +user1.name="Tim cook" +print(user1.name) +print(user1.total) + +#Output: Tim cook +# Tim cook has 10000 dollars in the account From 5c0e4b2f140f0103f004e035d57b13348ca25c99 Mon Sep 17 00:00:00 2001 From: arun tvs Date: Thu, 7 May 2020 13:57:41 +0530 Subject: [PATCH 07/13] Add simple django project (#16) --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index ab3fef9..c79a6c5 100644 --- a/README.md +++ b/README.md @@ -166,6 +166,8 @@ An example of Python Lambda function Encryption/ Decryption using RSA Algorithm * [Python ftplib](https://github.com/OmkarPathak/Python-Programs/blob/master/Programs/P76_PythonFTP.py) A simple Python FTP file transfer example +* [Python Django Project (beginner)](https://github.com/modernwarfareuplink/fyleBanksApi) +A simple Django Project with two endpoints to show IFSC and bank details # Donation From 2029a5ecfe7162e3cbd42ff4c75df019a23d7791 Mon Sep 17 00:00:00 2001 From: Omkar Pathak Date: Thu, 7 May 2020 15:01:02 +0530 Subject: [PATCH 08/13] Add files via upload --- Untitled (1).py | 174 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 Untitled (1).py diff --git a/Untitled (1).py b/Untitled (1).py new file mode 100644 index 0000000..318a38e --- /dev/null +++ b/Untitled (1).py @@ -0,0 +1,174 @@ +#!/usr/bin/env python +# coding: utf-8 + +# # File Handling using Python + +# In[1]: + + +# open(filename, mode) + +# r - reading +# w - writing +# a - appending + + +# In[7]: + + +file = open('social.txt', 'r') +data = file.read() + +# if for + +file.close() + +print(file.closed) + + +# In[11]: + + +# context manager + +with open('social.txt', 'r') as file: + data = file.read() + +print(file.closed) + + +# In[15]: + + +with open('something.txt', 'a') as file: + file.write('MMCOE - yethe bahutanche hith!') + + +# In[18]: + + +with open('social.txt', 'r') as fd: + data = fd.read(6) # how many bytes or characters you have to read + +print(data) + + +# In[21]: + + +import os + +print(os.getcwd()) + + +# In[22]: + + +print('Original Directory:', os.getcwd()) +os.chdir('/home/omkarpathak/Documents/Notebooks') +print('Current Directory:', os.getcwd()) + + +# In[24]: + + +print(os.listdir()) + + +# In[30]: + + +files = [] + +files = os.listdir() + +# os.path.isfile(filename) # return True is it is a file, else it returns False + +for file in files: + if os.path.isfile(os.path.abspath(file)): + print('File:', file) + +for file in files: + if os.path.isdir(os.path.abspath(file)): + print('Dir:', file) + + +# In[68]: + + +os.chdir('/home/omkarpathak/Documents/PythonLecture/Naruto/Directory0') + +for i in range(10): + os.mkdir('Directory' + str(i) + str(i)) # creating a folder + os.chdir('Directory' + str(i) + str(i)) # Directory0 -> Directory1 + with open('something.txt', 'w') as file: + file.write('Text') + os.chdir('/home/omkarpathak/Documents/PythonLecture/Naruto/Directory0') + + +# In[47]: + + +os.chdir('/home/omkarpathak/Documents/PythonLecture/') + + +# In[44]: + + +mylist = ['omkar', 1, 3, 4.0] +print(mylist) + + +# In[53]: + + +word_to_check = 'hilarious' + +with open('social.txt', 'r') as file: + data = file.read() + +for line in data.split('\n'): + if word_to_check in line: + print('True') + print(line) + +print(len(data.split('\n'))) + + +# In[72]: + + +os.chdir('/home/omkarpathak/Documents/PythonLecture') +with open('social.txt', 'r') as file: + data = file.read() + +char = 'M' +# print(data.lower()) +print(data.lower().count(char.lower())) + + +# In[60]: + + +with open('social.txt', 'r') as file: + data = file.read() + +char = input('Enter a character of your choice:') + +print(data.lower().count(char)) + + +# In[76]: + + +string = 'My namename is Omkar' +print(string.count('name')) # fuzzy search + + +# In[ ]: + + +import numpy +import scipy +import matplotlib + From e0eb3f767207598895a8e86e583cf7cf1f1e60a0 Mon Sep 17 00:00:00 2001 From: Vishal Naik <59202862+Monsieurvishal@users.noreply.github.com> Date: Sun, 21 Jun 2020 11:19:28 +0530 Subject: [PATCH 09/13] alternate program update (#21) Press enter to start and stop the watch --- Programs/P19_SimpleStopWatch.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Programs/P19_SimpleStopWatch.py b/Programs/P19_SimpleStopWatch.py index 59eec6b..bbbff67 100644 --- a/Programs/P19_SimpleStopWatch.py +++ b/Programs/P19_SimpleStopWatch.py @@ -14,3 +14,32 @@ endtime = time.time() print('Total Time:', round(endtime - starttime, 2),'secs') break +# Press enter to start and stop the watch +""" +import time + +print('Press Enter to begin, Press Enter again to stop') +if input()=='': + starttime = time.time() + print('Started') + while True: + val=input() #For ENTER + if val=='': + print('Stopped') + endtime = time.time() + print('Total Time:', round(endtime - starttime, 2),'secs') + break + +""" + +""" +Output: +Press Enter to begin, Press Enter again to stop + +Started + +Stopped +Total Time: 1.05 secs + +""" + From 1b303377aa3a484dd1cbdaeaa94f719cd6d40dea Mon Sep 17 00:00:00 2001 From: Vishal Naik <59202862+Monsieurvishal@users.noreply.github.com> Date: Tue, 23 Jun 2020 14:37:39 +0530 Subject: [PATCH 10/13] fixed indexing error (#23) Enter your message: vishal Enter you key [1 - 26]: 7 Encrypt or Decrypt? [E/D]: e --------------------------------------------------------------------------- IndexError Traceback (most recent call last) in 35 36 if __name__ == '__main__': ---> 37 main() in main() 30 31 if choice.lower().startswith('e'): ---> 32 print(encrypt(message, key)) 33 else: 34 print(decrypt(message, key)) in encrypt(message, key) 9 num = LETTERS.find(chars) 10 num += key ---> 11 encrypted += LETTERS[num] 12 13 return encrypted IndexError: string index out of range ______________________________________________ Above issue was solved --- Programs/P40_CipherText.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Programs/P40_CipherText.py b/Programs/P40_CipherText.py index 3733f43..e092f31 100644 --- a/Programs/P40_CipherText.py +++ b/Programs/P40_CipherText.py @@ -11,7 +11,10 @@ def encrypt(message, key): if chars in LETTERS: num = LETTERS.find(chars) num += key - encrypted += LETTERS[num] + if num>25: + num=num%25 + num=num-1 + encrypted =encrypted + LETTERS[num] return encrypted @@ -21,8 +24,11 @@ def decrypt(message, key): for chars in message: if chars in LETTERS: num = LETTERS.find(chars) - num -= key - decrypted += LETTERS[num] + if num>25: + num=num%25 + num=num-1 + num = num -key + decrypted =decrypted+LETTERS[num] return decrypted From 5893eca078094623e6f8e37c4958d5ec01d8dac7 Mon Sep 17 00:00:00 2001 From: Tej Pratap Yadav <60545022+tyadav4268@users.noreply.github.com> Date: Fri, 2 Oct 2020 08:56:15 +0530 Subject: [PATCH 11/13] Update P72_PythonLambda.py (#41) Added some lines to demonstrate the use of lambda function in a more compact way. for example directly passing the arguments to lambda function. --- Programs/P72_PythonLambda.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/Programs/P72_PythonLambda.py b/Programs/P72_PythonLambda.py index 77b2da4..67fc881 100644 --- a/Programs/P72_PythonLambda.py +++ b/Programs/P72_PythonLambda.py @@ -10,14 +10,24 @@ # expression using these arguments. You can assign the function to a variable to give it a name. # The following example of a lambda function returns the sum of its two arguments: -myFunc = lambda x, y: x * y -# returns 6 -print(myFunc(2, 3)) +myFunc = lambda x, y: x * y -# example to find squares of all numbers from a list +print(myFunc(2, 3)) #output: 6 + +#Here we are directly creating the function and passing the arguments +print((lambda x, y: x * y)(2, 3)) #same output i.e 6 + +print(type(lambda x, y: x * y)) #Output: + +# example to find squares of all numbers of a list myList = [i for i in range(10)] + # returns square of each number -myFunc = lambda x: x * x +myFunc2 = lambda x: x * x + +squares = list(map(myFunc2, myList)) +print(squares) # Output: [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] + +print(list(map(lambda x: x * x, myList))) #same as above + -squares = list(map(myFunc, myList)) -print(squares) # [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] From 6039e35b51696cbe7c71cc4a5cfdc743b1bdef1b Mon Sep 17 00:00:00 2001 From: Yash <33280486+yash-odint@users.noreply.github.com> Date: Fri, 2 Oct 2020 09:04:58 +0530 Subject: [PATCH 12/13] Update P04_Factorial.py (#28) --- Programs/P04_Factorial.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Programs/P04_Factorial.py b/Programs/P04_Factorial.py index 5798ccf..fb29789 100644 --- a/Programs/P04_Factorial.py +++ b/Programs/P04_Factorial.py @@ -1,5 +1,6 @@ #Author: OMKAR PATHAK #This program finds the favtorial of the specified numbers +#For example, factorial of 5 = 5*4*3*2*1 = 120 def factorial(number): '''This function finds the factorial of the number passed as argument''' From ed96a4f7b2ddcad5be6c6a0f13cff89975731b77 Mon Sep 17 00:00:00 2001 From: Gunjan Kadel <86482290+GunjanKadel@users.noreply.github.com> Date: Sun, 12 Sep 2021 17:02:13 +0530 Subject: [PATCH 13/13] Added a Basic Chatbot program using Python (#76) --- Programs/Chatbot.py | 145 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 Programs/Chatbot.py diff --git a/Programs/Chatbot.py b/Programs/Chatbot.py new file mode 100644 index 0000000..7c35e98 --- /dev/null +++ b/Programs/Chatbot.py @@ -0,0 +1,145 @@ +# -*- coding: utf-8 -*- +import nltk +from nltk.chat.util import Chat, reflections + +reflections = { + "i am" : "you are", + "i was" : "you were", + "i" : "you", + "i'm" : "you are", + "i'd" : "you would", + "i've" : "you have", + "i'll" : "you will", + "my" : "your", + "you are" : "I am", + "you were" : "I was", + "you've" : "I have", + "you'll" : "I will", + "your" : "my", + "yours" : "mine", + "you" : "me", + "me" : "you", + +} +pairs = [ + [ + r"my name is (.*)", + ["Hello %1, How are you today ?",] + ], + [ + r"hi|hey|hello", + ["Hello", "Hey there",] + ], + [ + r"what is your name ?|your name|name please", + ["I am Y2K. You can call me crazy individual!",] + ], + [ + r"how are you ?|how you doing|what about you|how about you ?", + ["I'm doing good. How can I help you ?",] + ], + [ + r"sorry (.*)", + ["Its alright","Its OK, never mind",] + ], + [ + r"I am fine", + ["Great to hear that, How can I help you?",] + ], + [ + r"(.*) continents", + ["Asia, Africa, North America, South America, Antarctica, Europe, and Australia ",] + ], + [ + r"(.*) (english|hollywood) movie", + ["The Shawshank Redemption", " The Lord of the Rings: The Return of the King","Inception", "Interstellar", "Parasite", "Twilight", "Fast & Furious", "Lucky one","A walk to remember", "The Last Song", "The Notebook","The Fault in Our Stars", "Joker", "Me Before You", "All the boys have met before","Kissing booth", "Titanic",] + ], + [ + r"i'm (.*) doing good", + ["Nice to hear that","How can I help you?:)",] + ], + [ + r"(.*) age?|are you an (idiot|stupid)|what do you think you are", + ["I'm a computer program dude....Seriously you are asking me this?",] + ], + [ + r"(.*) (online|free) courses", + ["Udemy","Udacity","Great Learning","Google Digital Garage","Swayam",] + ], + [ + r"(.*) (news channel|news)", + ["BCC World News","Fox News","Cable News Network (CNN)","Sky News","MSNCB","Republic World","ZEE News","ABP News",] + ], + [ + r"(.*) (horror|spooky) movie", + ["The Nun", "Annabelle", "The conjuring", "Sinister", "The cabin in the wood", "insidious", "IT","Ouija", "Train to Busan", "The Ring", "Hush", "Evil Dead", "Oculus",] + ], + [ + r"(.*) (bollywood|hindi) movie", + ["War", "My name is Khan", "Happy new year", "Dilwale", "Uri", "Don", "Don 2", "Raees","Raazi", "Kalank", "Kalank", "Dangal", "LUDO", "Good Newz", "PK", "Jab Tak Hai Jaan","Cocktail", "Bahubali", "M.S.Dhoni", "Aashiqui 2","Dear Zindagi","Anand", "Mughal-E-Azam", "Mother India", "Don ", " Parinda", "Mr. India","Mera Naam Joker", "Amar, Akbar and Anthony", " Agneepath ", "Sahib Bibi Aur Ghulam","Sholay",] + ], + [ + r"(.*) (webseries|series)", + ["You", "Lucifer", "Cursed", "Mismatched", "Money Heist", "Stranger Things", "Merlin","The Protector", "Sabrina", "Dark", "Friends", "The Big Bang Theory", "Little Things","Lock & Key", "Sherlock", "Sweet Tooth", "The Witcher", "Shadow and Bones","Never Have i ever", "Brooklyn Nine-Nine", "Ragnarok", "Originals", "Vampire Diaries","The Order", "The Boss Baby", "The Haunting of Hill House", "Pup Academy", "Mary Queen of Scots","Bitten", "Titans", "Warrior Nun","The Haunting of bly Manor",] + ], + [ + r"(.*) k-drama", + ["descendants of the sun","busted", "her private life", "whats wrong with secretary kim","its okay to not be okay", "hospital playlist", "crash landing on you","weightlifting fairy kim bok joo", "my first first love", "beauty inside", "was it love",] + ], + [ + r"(.*) (novel|book)", + ["Harry Potter", "Twilight", "Alchemist", "Angel And Demon", "Dead Beautiful", "Lost Symbol", "The Vinche Code", "Hunger Games",] + ], + [ + r"(.*) created ?", + ["I am created using Python's NLTK library ","top secret",] + ], + [ + r"(.*) band", + ["BTS", "The Beatles", "The rolling stones", "Maroon 5", "One Direction", "No Doubt","Black Pink", "EXO", "MonstaX", "Stray Kids","The chainsmokers",] + ], + [ + r"(.*) actress", + ["Scarlett Johansson", "Jennifer Lawrence", "Emma Watson", " Margot Robbie","Angelina Jolie", "Kristen Stewart", "Rachel McAdams","Deepika Padukone", "Priyanka Chopra", "Alia Bhatt", "Kareena Kapoor","Nora Fatehi", "Jacqueline Fernandez", "Aishwarya Rai", "Sara Ali Khan", "Shraddha Kapoor","Anushka Sharma", "Disha Patani",] + ], + [ + r"(.*) (game|sport)", + ["Cricket","Hockey", "Basketball", "Football", "Baseball","Badminton", "Tennis", "Swimming", "Archery","Skates", "Volleyball", "Table Tennis", "Golf",] + ], + [ + r"(.*) (sports person|player)", + ["Lionel Messi","Sania Mirza", "Sachin Tendulkar", "Virat Kohli", "Kevin Durant","Hardik Pandya", "Rohit Sharma", "P. V. Sindhu", "Parupalli Kashyap","Sania Mirza", "Dhyan Chand", "Cristiano Ronaldo", "Robert Lewandowski","Chris Gayle", "Steve Smith", "David Warner", "Ricky Ponting","Stephen Curry", "LeBron James", "M.S.Dhoni", "Chris Paul",] + ], + [ + r"(.*) actor", + ["Robert Downey, Jr.", "Chris Hemsworth", "Tom Holland", "Brad Pitt","Tom Hiddleston", "Tom Cruise", "Chris Evans", "Benedict Cumberbatch","Paul Rudd", "Jeremy Renner", "Ian Somerhalder ","Paul Wesley", "Aamir Khan", "Amitabh Bachchan","Anil Kapoor", "Ranveer Singh", "Ranbir Kapoor", "Salman Khan","Sanjay Dutt", "Shah Rukh Khan", "Tiger Shroff", "Varun Dhawan",] + ], + [ + r"(.*) dialogue", + ["Mere paas maa hai.","Pushpa, I hate tears…","Kitne aadmi the!","Babumoshai, zindagi badi honi chahiye, lambi nahi.","Rishtey mein toh hum tumhare baap lagte hai, naam hai Shahenshaah!","Dosti ka ek usool hai madam – no sorry, no thank you.","Mogambo khush hua!","Hum jahan khade hote hain line yahi se shuru hoti hai.","Bade bade deshon mein aisi choti-choti baatein hoti rehti hai, Senorita.","Haar kar jeetne wale ko baazigar kehte hai.","Mere Karan Arjun aayenge.","Agar maa ka doodh piya hai toh samne aa!","Uska to na bad luck hi kharab hai.","Crime Master Gogo naam hai mera, aankhen nikal ke gotiyan khelta hun main.","Tareekh pe tareekh, tareekh pe tareekh, tareekh pe tareekh milti gayi My Lord, par insaaf nahi mila","Rahul, naam toh suna hi hoga.","Mein apni favourite hoon!","Picture abhi baaki hai mere dost!","How’s the josh?","Thappad se darr nahi lagta sahab, pyaar se lagta hai.","Filmein sirf teen cheezo ke wajah se chalti hai…entertainment, entertainment, entertainment…aur main entertainment hoon.","All izz well",] + ], + [ + r"quit", + ["Bye take care. See you soon :) ","It was nice talking to you. See you soon :)",] + ], + [ + r"(.*) joke", + ["Why did the tomato blush? Because it saw the salad dressing.","What do you call bears with no ears? B","What do dentists call X-rays? Tooth pics.","Did you hear about the first restaurant to open on the moon? It had great food, but no atmosphere.","What did one wall say to the other wall? I’ll meet you at the corner.","When does a joke become a “dad” joke? When the punchline is apparent.","What did the paper say to the pencil? Write on!","How did the bullet lose its job? It got fired.","Why should you never trust stairs? They are always up to something.","Sometimes I tuck my knees into my chest and lean forward.That’s just how I roll.","What do you call a cheese that’s not yours? Nacho cheese!","Did you hear about the cheese factory that exploded in France?There was nothing left but de Brie.",] + ], + [ + r"even me", + ["That's great"] + ], + [ + r"thank you", + ["Your welcome , would you like to know something else if no then please type in QUIT to exit",] + ], +] +def chat(): + print("Hi! I am Y2K..") + chat = Chat(pairs, reflections) + chat.converse() + +#initiate the conversation +if __name__ == "__main__": + chat() \ No newline at end of file