diff --git a/DataStructure/bubble_sort.py b/DataStructure/bubble_sort.py index cb82f16..27947d1 100644 --- a/DataStructure/bubble_sort.py +++ b/DataStructure/bubble_sort.py @@ -1,9 +1,9 @@ -x =[3,56,2,56,78,56,34,23,4,78,8,123,45] -for i in range(1,len(x)): - for j in range(0,13-i): - if(x[j]>x[j+1]): - x[j],x[j+1] = x[j+1],x[j] +x = [3, 56, 2, 56, 78, 56, 34, 23, 4, 78, 8, 123, 45] +for i in range(1, len(x)): + for j in range(0, 13-i): + if(x[j] > x[j+1]): + x[j], x[j+1] = x[j+1], x[j] -print("Sorted Array :") +print("Sorted Array :") for i in x: - print(i,end =" ") + print(i, end=" ") diff --git a/DataStructure/insertion_sort.py b/DataStructure/insertion_sort.py index 5966f1b..0ff532d 100644 --- a/DataStructure/insertion_sort.py +++ b/DataStructure/insertion_sort.py @@ -1,12 +1,12 @@ -x =[3,56,2,56,78,56,34,23,4,78,8,123,45] -for i in range(1,13): - j= i-1 +x = [3, 56, 2, 56, 78, 56, 34, 23, 4, 78, 8, 123, 45] +for i in range(1, 13): + j = i-1 temp = x[i] - while(temp=0): - x[j+1]=x[j] + while(temp < x[j] and j >= 0): + x[j+1] = x[j] j = j-1 - x[j+1] = temp - -print("Sorted Array :") + x[j+1] = temp + +print("Sorted Array :") for i in x: - print(i,end =" ") \ No newline at end of file + print(i, end=" ") diff --git a/DataStructure/merge_python_way.py b/DataStructure/merge_python_way.py new file mode 100644 index 0000000..992f7c9 --- /dev/null +++ b/DataStructure/merge_python_way.py @@ -0,0 +1,4 @@ +x =[1,2,3,4,5,6,7,8] +y = [1,2,3,4,5] +z= x+y +print(z) diff --git a/Email/spam_Words.py b/Email/spam_Words.py new file mode 100644 index 0000000..3b0e2bc --- /dev/null +++ b/Email/spam_Words.py @@ -0,0 +1,47 @@ +import imapclient # use pip install imapclient <- easy for reading different email Server +import pyzmail # easy to read different part of EMail like subject / body /cc/bcc/to/from etc +from collections import Counter + +d=[] +imapObj = imapclient.IMAPClient('imap.gmail.com', ssl=True) # email server for Gmail +username=input("Enter your completer gmail User Name ") +Password=input("Enter your gmail passowrd") +imapObj.login(username,Password) # login Method for your email +print("Dear", username," you are logged into your account") +imapObj.select_folder('[Gmail]/Spam', readonly=True) # selecting different folder for phising email i used Spam +UIDs = imapObj.search(['ALL']) # different filter for mailboxes ALL/SEEN/UNSEEN it returns ids for the filter you have search +print( "No of emails in your [Gmail]/Spam' box=" ,len(UIDs)) +print("Mail from\t\t"," Subject Line") +for i in UIDs: # only 10 emails to be taken + rawMessages = imapObj.fetch([i], ['BODY[]', 'FLAGS']) # fetch the email message for particular UID + message = pyzmail.PyzMessage.factory(rawMessages[i][b'BODY[]']) # Parse the raw email message. + print(message.get_addresses('from'),message.get_subject()) # return the subject part of email + message.text_part != None # check for text part of body message Message can have html part also + d.append(message.text_part.get_payload().decode(message.text_part.charset)+"\n") # fetch the textpart + #get_payload() method that returns the email’s body as a value of the bytes data type But this still isn’t a string value that we can use. + #decode() method takes one argument: the message’s character encoding, + #stored in the text_part.charset or html_part.charset attribute. This, finally, will return the string of the email’s body. +imapObj.logout() +print("Logged out successfully from server...") + +with open("E:\email2.txt", 'w') as fp: + for i in range(len(d)): + fp.write(str(d[i])) + + +file = open("E:\email2.txt") +split_it=[] +for line in file: + line=line.strip() + split_it+=line.split() # split() returns list of all the words in the string + + +# Pass the split_it list to instance of Counter class. +Counter = Counter(split_it) +# most_common() produces k frequently encountered +# input values and their respective counts. +print( "most common word found in EMails") +num=int(input("How many most common words you want to find")) +most_occur = Counter.most_common(num) +for com in most_occur: + print(com[0],"=>",com[1]) \ No newline at end of file diff --git a/Loops/anagram.py b/Loops/anagram.py new file mode 100644 index 0000000..faa5e63 --- /dev/null +++ b/Loops/anagram.py @@ -0,0 +1,16 @@ +# program to find out all anagram of given word +# made by : rakesh kumar + +from itertools import permutations + +def words(letters): + yield from map(''.join, permutations(letters, len(letters))) + +result = set() +for word in words('Compute'): + result.add(word) + +print(f' There are {len(result)} combinations') +print(result) + + diff --git a/Loops/if_python_way.py b/Loops/if_python_way.py new file mode 100644 index 0000000..e790e43 --- /dev/null +++ b/Loops/if_python_way.py @@ -0,0 +1,3 @@ +x = 1 +result = "found" if x == 1 else "not found" +print(result) diff --git a/Text_Speech.py b/Text_Speech.py index a76ca68..bc10afb 100644 --- a/Text_Speech.py +++ b/Text_Speech.py @@ -8,7 +8,7 @@ import os # The text that you want to convert to audio -mytext = 'My Baby samraddhi is playing with my mobile phone. Welcome to binarynote.com and this is really amazing my dear!' +mytext = 'My Baby samraddhi is playing with my mobile phone.Amazing my dear!' # Language in which you want to convert language = 'en' diff --git a/add.py b/add.py index b4d0891..722433c 100644 --- a/add.py +++ b/add.py @@ -3,5 +3,5 @@ d= 10 a= a+2 b = b-20 -a= c-30 +a= b-30 print(a) \ No newline at end of file diff --git a/database/database_complete.py b/database/database_complete.py index d711dfe..67bfdf5 100644 --- a/database/database_complete.py +++ b/database/database_complete.py @@ -1,4 +1,4 @@ -#------------------------------------------------------------------------------- +# ------------------------------------------------------------------------------- # Name: module1 # Purpose: # @@ -7,50 +7,56 @@ # Created: 12-04-2018 # Copyright: (c) acer 2018 # Licence: -#------------------------------------------------------------------------------- +# ------------------------------------------------------------------------------- import MySQLdb + def show_records(): - db= MySQLdb.connect("localhost","root","ramji","cable") + db = MySQLdb.connect("localhost", "root", "ramji", "cable") cursor = db.cursor() - sql ="select * from customer" + sql = "select * from customer" cursor.execute(sql) results = cursor.fetchall() - for idr,name,fname,add,phone,email in results: - print(idr,name,fname,phone,email) + for idr, name, fname, add, phone, email in results: + print(idr, name, fname, phone, email) db.close() + def del_record(): - db= MySQLdb.connect("localhost","root","ramji","cable") + db = MySQLdb.connect("localhost", "root", "ramji", "cable") cursor = db.cursor() name = input("Enter name you want to delete") - sql ="delete from customer where name like '%" + name +"'%" + sql = "delete from customer where name like '%" + name + "'%" cursor.execute(sql) - db.commit(); - db.close(); + db.commit() + db.close() print("Record Deleted successfully") + + def update_record(): - db= MySQLdb.connect("localhost","root","ramji","cable") + db = MySQLdb.connect("localhost", "root", "ramji", "cable") cursor = db.cursor() email = input("Admin ID :") - sql ="update customer set email = 'admin@binarynote.com where email like '%" + email +"'%" + sql = "update customer set email = 'admin@binarynote.com where email like '%" + email + "'%" cursor.execute(sql) - db.commit(); - db.close(); + db.commit() + db.close() print("Record Updated successfully") + def main(): - n=1 - while n!=4: + n = 1 + while n != 4: n = int(input("Enter any no (1..3) ")) print(n) - if n==1: + if n == 1: show_records() - if next==2: + if next == 2: del_record() - if next==3: + if next == 3: update_record() + if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/examveda.txt b/examveda.txt new file mode 100644 index 0000000..86aeece --- /dev/null +++ b/examveda.txt @@ -0,0 +1,735 @@ + + + + + + + + + Accounting MCQ Questions and Solutions with Explanations | Commerce + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + +
+
+ +
+
+ +
+ + +
+
+ + + + +
+
+ +
+

1.
Accounting provides information on +
+

+ +
+ +
+
+ +

+ + + +

+

+ + + +

+

+ + + +

+

+ + + +

+ + +
+
+
+ + + + + + + +
+ + +
+
+ +
+

2.
The long term assets that have no physical existence but are rights that have value is known as +
+

+ +
+ +
+
+ +

+ + + +

+

+ + + +

+

+ + + +

+

+ + + +

+ + +
+
+
+ + + + + + + +
+ + +
+
+ +
+

3.
The assets that can be converted into cash within a short period (i.e. 1 year or less) are known as +
+

+ +
+ +
+
+ +

+ + + +

+

+ + + +

+

+ + + +

+

+ + + +

+ + +
+
+
+ + + + + + + +
+ +
+ + + +
+ +
+
+ +
+

4.
+
Patents, Copyrights and Trademarks are
+

+ +
+ +
+
+ +

+ + + +

+

+ + + +

+

+ + + +

+

+ + + +

+ + +
+
+
+ + + + + + + +
+ + +
+
+ +
+

5.
The debts which are to be repaid within a short period (year or less) are known as +
+

+ +
+ +
+
+ +

+ + + +

+

+ + + +

+

+ + + +

+

+ + + +

+ + +
+
+
+ + + + + + + +
+ + +
+ + + +
+ + + + + + +
+

Read More Section(Accounting)

+

Each Section contains maximum 70 questions. To get more questions visit other sections.

+ +
+ + +
+ +
+
+
+
+
+
+
+ + +
+
+
+
+ + + + + + + +
+ + + + + + + + + diff --git a/fileHandling/delete All File with extension_EXE.py b/fileHandling/delete All File with extension_EXE.py index 0d953f9..f36af00 100644 --- a/fileHandling/delete All File with extension_EXE.py +++ b/fileHandling/delete All File with extension_EXE.py @@ -19,7 +19,7 @@ def main(): for root, SubFolders , files in os.walk(directory): os.chdir(root) files = glob.glob('*.exe') - print(files) + # print(files) for filename in files: os.unlink(filename) count+=1 diff --git a/list/bubble_sort.py b/list/bubble_sort.py new file mode 100644 index 0000000..874823b --- /dev/null +++ b/list/bubble_sort.py @@ -0,0 +1,12 @@ +''' program to arrange list element using bubble sort metod + made by : rakesh kumar + last edited :20-aug-2019''' + +x = [23, 5, 67, 8, 324, 6, 89, 9, 23, 1, 4, 89] +n = len(x) +for i in range(n-1): + for j in range(n-i-1): + if x[j] > x[j+1]: + x[j], x[j+1] = x[j+1], x[j] + +print(x) diff --git a/list/frequency_table.py b/list/frequency_table.py new file mode 100644 index 0000000..c59575c --- /dev/null +++ b/list/frequency_table.py @@ -0,0 +1,13 @@ +list1 = [1, 2, 3, 4, 5, 6, 7, 8, 1, 3, 2, 4, 2, 1, 5, 6, 7, 2, 3, 4, 1] + +num = [] +freq = [] + +for i in list1: + if i not in num: + num.append(i) + count = list1.count(i) + freq.append(count) + +for i in range(len(num)): + print(num[i], 'appear', freq[i], 'times') diff --git a/list/frequency_table_dict.py b/list/frequency_table_dict.py new file mode 100644 index 0000000..7fcb478 --- /dev/null +++ b/list/frequency_table_dict.py @@ -0,0 +1,14 @@ +''' program to find out frequency of each element in a list using dictionary + made by : rakesh kumar + last compiled on : 10-08-2018 +''' + +list1 = [1, 2, 3, 4, 5, 6, 7, 8, 1, 3, 2, 4, 2, 1, 5, 6, 7, 2, 3, 4, 1] +freq = {} +for i in list1: + if i not in freq: + count = list1.count(i) + freq[i] = count + +for i in freq: + print(i, 'appear', freq[i], 'times') diff --git a/list/selection_sort.py b/list/selection_sort.py new file mode 100644 index 0000000..30ccc5f --- /dev/null +++ b/list/selection_sort.py @@ -0,0 +1,16 @@ +''' program to arrange list element using selection sort method + made by : rakesh kumar + last edited :20-aug-2019''' + +x = [23, 5, 67, 8, 324, 6, 89, 9, 23, 1, 4, 89] +n = len(x) +for i in range(1, n): + temp = x[i] + j = i-1 + while(temp < x[j] and j >= 0): + x[j+1] = x[j] + j = j-1 + + x[j+1] = temp + +print(x) diff --git a/list/unique_numbers.py b/list/unique_numbers.py new file mode 100644 index 0000000..7849e66 --- /dev/null +++ b/list/unique_numbers.py @@ -0,0 +1,12 @@ +''' program to find out unique element in a list + made by : rakesh kumar + last compiled on : 10-08-2018 +''' + +list1 = [1, 2, 3, 4, 5, 6, 7, 8, 1, 3, 2, 4, 2, 1, 5, 6, 7, 2, 3, 4, 1] +num = [] +for i in list1: + if i not in num: + num.append(i) + +print(num) diff --git a/list/user_generated_list.py b/list/user_generated_list.py new file mode 100644 index 0000000..de7e45c --- /dev/null +++ b/list/user_generated_list.py @@ -0,0 +1,17 @@ +''' program to create a user generated list and then find out largest and lowest element + made by : rakesh kumar + last modified : 20-auguest-2018 ''' + +number = [] +while True: + x = int(input('Enter any number :')) + if x == 0: + break + number.append(x) + +largest = max(number) +lowest = min(number) + +print("\n\n") +print("largest Number :", largest) +print("Lowest Number :", lowest) diff --git a/numpy/intro1-.py b/numpy/intro1-.py new file mode 100644 index 0000000..e69de29 diff --git a/string/count_chars.py b/string/count_chars.py new file mode 100644 index 0000000..4b7db42 --- /dev/null +++ b/string/count_chars.py @@ -0,0 +1,7 @@ +string = input("Enter any string :") +count =0 +for i in string: + count = count+1 + +print("Total Chars :",count) + diff --git a/string/count_chars_using _len_function.py b/string/count_chars_using _len_function.py new file mode 100644 index 0000000..a97a572 --- /dev/null +++ b/string/count_chars_using _len_function.py @@ -0,0 +1,7 @@ +string = '''Dear Parents +This is to inform you that C.B.S.E is organizing a four day capacity building program in our school from 27 august to 30th august 2019 and DAVCAE is organizing performance enhancement program on 31st august 2019. As the principal & the teachers will remain busy during these 5 days, they shall not be able to address your problem. Therefore you are requested not to visit the school on these mentioned dates and face inconvenience. +However the fee counter will remain open for transactions if any. Looking forward to your continued support and co-operation +Regards +Archana Koul''' + +print(len(string)) diff --git a/string/reverse_string.py b/string/reverse_string.py new file mode 100644 index 0000000..7a165e4 --- /dev/null +++ b/string/reverse_string.py @@ -0,0 +1,5 @@ +string =input("Enter any string :") + +n = len(string) +for i in range(n-1,-1,-1): + print(string[i],end='') diff --git a/string/search_char_without_function-1.py b/string/search_char_without_function-1.py new file mode 100644 index 0000000..ff1b662 --- /dev/null +++ b/string/search_char_without_function-1.py @@ -0,0 +1,19 @@ +''' program to search a char from a string + made by : rakesh + last edited : 26-aug-2019 +''' + +string = "umbrella" +char = 'e' + +jatin =9010 + +for i in string: + if char ==i: + jatin = 1010 + + +if(jatin==1010): + print("found") +else: + print("not found") diff --git a/string/search_char_without_function.py b/string/search_char_without_function.py new file mode 100644 index 0000000..f0d18ad --- /dev/null +++ b/string/search_char_without_function.py @@ -0,0 +1,7 @@ +string = "umbrella" +char = 'e' + +if char in string: + print("Available") +else: + print("not available") diff --git a/string/substring_string.py b/string/substring_string.py new file mode 100644 index 0000000..78be86a --- /dev/null +++ b/string/substring_string.py @@ -0,0 +1,41 @@ +''' program to find out substring in a given substring + made by : rakesh kumar + last editted : 26-auguest 2019 ''' + +string = "this is orange juice" +sub = 'orange' + +# method -1 +# if sub in string: +# print("present") +# else: +# print("non present") + +#method - 2 + +# found = string.find(sub) +# if(found != -1): +# print("found") +# else: +# print("not found") + +# method -3 +# if sub in string.split(): +# print("found") +# else: +# print("not found") + +# method -4 +# count = string.count(sub) +# if(count != 0): +# print("found") +# else: +# print("not found") + +#method - 5 + +# result = "found" if sub in string else "not found" +# print(result) + +#method -6 +print("found" if sub in string else "not found") diff --git a/webscraper/examveda.py b/webscraper/examveda.py new file mode 100644 index 0000000..74d455a --- /dev/null +++ b/webscraper/examveda.py @@ -0,0 +1,30 @@ +import requests +from bs4 import BeautifulSoup + +source = requests.get("https://www.examveda.com/commerce/practice-mcq-question-on-accounting/?page=2",'lxml').text +soup = BeautifulSoup(source,'lxml') +#print(soup.prettify()) + +for article in soup.find_all('article',class_='question single-question question-type-normal'): + try: + question_no = article.find('div', class_="question-number") + question = article.find('div', class_="question-main").text + parts = article.find('div', class_="question-options") + answer = article.find('span', class_="color").text + answer_content = article.find('div', class_="page-content") + answer_key = answer_content.find('strong').text + #print(answer_content.prettify()) + solution = article.find('span').text + + print(question_no.text, question) + parts = article.find('div', class_="question-options") + i = 1 + for option in parts.find_all('label'): + if(i % 2 == 0): + print(option.text) + i = i+1 + print(answer, answer_key) + + except: + pass + diff --git a/webscraper/whatsappmsg.py b/webscraper/whatsappmsg.py new file mode 100644 index 0000000..e69de29 diff --git a/webscraper/youtubeDownloader.py b/webscraper/youtubeDownloader.py index 093d61e..ecb2c75 100644 --- a/webscraper/youtubeDownloader.py +++ b/webscraper/youtubeDownloader.py @@ -1,7 +1,8 @@ from __future__ import unicode_literals import youtube_dl -import urllib -import shutil +# import urllib +# import shutil ydl_opts = {} with youtube_dl.YoutubeDL(ydl_opts) as ydl: - ydl.download(['https://www.youtube.com/watch?v=a8aDcLk4vRc&list=PLeo1K3hjS3uset9zIVzJWqplaWBiacTEU&index=2']) \ No newline at end of file + ydl.download( + ['https://www.facebook.com/111437890200079/videos/2399259550150228/']) diff --git a/welcome.mp3 b/welcome.mp3 index 564930f..5550d20 100644 Binary files a/welcome.mp3 and b/welcome.mp3 differ