-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
933 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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=" ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<x[j] and j>=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 =" ") | ||
print(i, end=" ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
x = 1 | ||
result = "found" if x == 1 else "not found" | ||
print(result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
''' 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) | ||
|
||
for i in num: | ||
print(i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
string = input("Enter any string :") | ||
count =0 | ||
for i in string: | ||
count = count+1 | ||
|
||
print("Total Chars :",count) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
string =input("Enter any string :") | ||
|
||
n = len(string) | ||
for i in range(n-1,-1,-1): | ||
print(string[i],end='') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
string = "umbrella" | ||
char = 'e' | ||
|
||
if char in string: | ||
print("Available") | ||
else: | ||
print("not available") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.