Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Anusha Devulapally #81

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
57b0db8
Add files via upload
anusha-devulapally Dec 3, 2020
6a23e21
Add files via upload
anusha-devulapally Dec 4, 2020
1a8560a
Add files via upload
anusha-devulapally Dec 5, 2020
cb522a3
To access new problems Merge remote-tracking branch 'upstream/main' i…
anusha-devulapally Dec 7, 2020
29eea2f
Add files via upload
anusha-devulapally Dec 7, 2020
7ef62a0
Merge remote-tracking branch 'upstream/main' into main
anusha-devulapally Dec 24, 2020
075c427
Add files via upload
anusha-devulapally Dec 24, 2020
d942095
Add files via upload
anusha-devulapally Dec 24, 2020
666c3c3
Update python3_anusha_devulapally_max's_party.py
anusha-devulapally Dec 24, 2020
aa18ff3
Add files via upload
anusha-devulapally Dec 24, 2020
3c47dbb
Merge remote-tracking branch 'upstream/main' into main
anusha-devulapally Dec 26, 2020
8f1202c
Add files via upload
anusha-devulapally Dec 29, 2020
b0e17f9
Add files via upload
anusha-devulapally Dec 29, 2020
17c1303
Add files via upload
anusha-devulapally Dec 29, 2020
c2aa506
Merge remote-tracking branch 'upstream/main' into main
anusha-devulapally Jan 1, 2021
974c86b
Add files via upload
anusha-devulapally Jan 1, 2021
957740f
Add files via upload
anusha-devulapally Jan 1, 2021
e67fb99
Add files via upload
anusha-devulapally Jan 1, 2021
576e0fd
Add files via upload
anusha-devulapally Jan 2, 2021
375d9db
Add files via upload
anusha-devulapally Jan 2, 2021
861a8ea
Add files via upload
anusha-devulapally Jan 2, 2021
7872de7
Add files via upload
anusha-devulapally Jan 2, 2021
813a4ff
Add files via upload
anusha-devulapally Jan 2, 2021
a56b02f
Add files via upload
anusha-devulapally Jan 2, 2021
8a38e3a
Add files via upload
anusha-devulapally Jan 8, 2021
fe5af11
Certificate
anusha-devulapally Jan 29, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions December-01/python3_anusha_devulapally_Sherlock's_quest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
def conv_no(s):
p=0
s=s[::-1]
for i in s:
p=i+p*10
return p

def sum_left_right(n):
digits=[]
while(n>0):
p=n%10
digits.append(p)
n=n//10
mid=len(digits)//2
left=digits[:mid]
right=digits[mid:]
sum_l=conv_no(left)
sum_r=conv_no(right)
return sum_l+sum_r

n=int(input())
if(n%3==0):
double=n*n
ans= sum_left_right(double)
if(ans==n):
print("Safe")
else:
print("Not Safe")
else:
print("Not Safe")

47 changes: 47 additions & 0 deletions December-02/python3_anusha_devulapally_The_Convo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
"""December 2.ipynb

Automatically generated by Colaboratory.

Original file is located at
https://colab.research.google.com/drive/1q0-dU1J4AGP-MDY5MV9UzVfYQ93IEDhg
"""

tele_dict={2:['a','b','c'],3:['d','e','f'],4:['g','h','i'],5:['j','k','l'],6:['m','n','o'],7:['p','q','r','s'],8:['t','u','v'],9:['w','x','y','z']}

n=int(input())
#Only 2 character combinations are allowed.
digits=[]
digits.append(n//10)
digits.append(n%10)
print(digits)

comb=[]
for i in tele_dict[digits[0]]:
for j in tele_dict[digits[1]]:
comb.append(i+j)
print(comb)

#back tracking
n=int(input())
digits=[]
while(n>0):
p=n%10
digits.append(p)
n=n//10
digits=digits[::-1]

def backtrack_combi(lists,result,depth,current):
if(depth==len(lists)):
result.append(current)
return
for i in range(len(lists[depth])):
backtrack_combi(lists,result,depth+1,current+lists[depth][i])

lists=[]
for i in digits:
lists.append(tele_dict[i])
result=[]
backtrack_combi(lists,result,0,"")
print(result)

41 changes: 41 additions & 0 deletions December-03/python3_anusha_devulapally_Meet_and_Greet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
"""December 3.ipynb

Automatically generated by Colaboratory.

Original file is located at
https://colab.research.google.com/drive/1q0-dU1J4AGP-MDY5MV9UzVfYQ93IEDhg
"""

# assuming the entered are in order
no_of_meetings= int(input("enter the no of meetings"))
total_meetings=[]
for i in range(no_of_meetings):
start_meet=input("enter starting time of the meeting")
end_meet=input("enter ending time of the meeting")
total_meetings.append([start_meet,end_meet])
print(total_meetings)

start_office='0900'
end_office='1700'

def difference(s,e):
s_min=(int(s[0])*10+int(s[1]))*60+(int(s[2])*10+int(s[3]))
e_min=(int(e[0])*10+int(e[1]))*60+(int(e[2])*10+int(e[3]))
return e_min-s_min

prev=start_office
next=end_office
result=[]
for i in range(no_of_meetings):
ans=difference(prev,total_meetings[i][0])
if(ans>=60):
result.append([prev,total_meetings[i][0]])
prev=total_meetings[i][1]
if(i==no_of_meetings-1):
ans=difference(total_meetings[i][1],next)
if(ans>=60):
result.append([total_meetings[i][1],next])

print(result)

29 changes: 29 additions & 0 deletions December-04/python3_anusha_devulapally_spoiled_or_not.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
no=int(input())

m_dates=[]
for i in range(no):
li=list(map(str,input().split()))
m_dates.append(li)

print(m_dates)

before=[]
for i in range(no):
before.append(int(input()))

given_date=list(map(str,input().split()))


def diff_dates(dt1,dt2):
t1=(int(dt1[2])-1)*360+int(dt1[0])+30*(int(dt1[1])-1)
t2=(int(dt2[2])-1)*360+int(dt2[0])+30*(int(dt2[1])-1)
return abs(t1-t2)

spoiled=0
for i in range(no):
diff=diff_dates(m_dates[i],given_date)
if(diff>before[i]):
spoiled+=1

print(spoiled)

55 changes: 55 additions & 0 deletions December-05/python3_anusha_devulapally_the_grand_master.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# -*- coding: utf-8 -*-
"""python3_anusha_devulapally_the_grand_master.ipynb

Automatically generated by Colaboratory.

Original file is located at
https://colab.research.google.com/drive/1q0-dU1J4AGP-MDY5MV9UzVfYQ93IEDhg
"""

m,n=map(int,input().split())

x,y=map(int,input().split())

tx,ty=map(int,input().split())

def isvalid(mat,x,y,m,n,t):
#li=[]
t=t+1
if (((x-1)>=0 and (y-2)>=0) and mat[x-1][y-2]==0):
mat[x-1][y-2]+=t
# li.append((x-1,y-2))
if (((x+1)<m and (y-2)>=0) and mat[x+1][y-2]==0):
mat[x+1][y-2]+=t
#li.append((x+1,y-2))
if (((x-2)>=0 and (y-1)>=0) and mat[x-2][y-1]==0):
mat[x-2][y-1]+=t
#li.append((x-2,y-1))
if (((x+2)<m and (y-1)>=0) and mat[x+2][y-1]==0):
mat[x+2][y-1]+=t
#li.append((x+2,y-1))
if (((x-2)>=0 and (y+1)<n) and mat[x-2][y+1]==0):
mat[x-2][y+1]+=t
#li.append((x-2,y+1))
if (((x-1)>=0 and (y+2)<n) and mat[x-1][y+2]==0):
mat[x-1][y+2]+=t
#li.append((x-1,y+2))
if (((x+1)<m and (y+2)<n) and mat[x+1][y+2]==0):
mat[x+1][y+2]+=t
#li.append((x+1,y+2))
if (((x+2)<m and (y+1)<n) and mat[x+2][y+1]==0):
mat[x+2][y+1]+=t
#li.append((x-2,y+1))

mat=[[0]*n for i in range(m)]
mat[x-1][y-1]=1
turn=1

while (mat[tx-1][ty-1]==0):
for i in range(m):
for j in range(n):
if (mat[i][j]==turn):
isvalid(mat,i,j,m,n,turn)
turn+=1
print("minmium steps",mat[tx-1][ty-1]-1)

46 changes: 46 additions & 0 deletions December-07/python3_anusha_devulapally_temperature_screening.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
"""December 7.ipynb

Automatically generated by Colaboratory.

Original file is located at
https://colab.research.google.com/drive/1q0-dU1J4AGP-MDY5MV9UzVfYQ93IEDhg
"""

counterA=[]
counterB=[]
temp_screening=[]

print("Enter Counter A names, enter 'q' to end")
k=input()
while(k!='q'):
counterA.append(k)
k=input()
print("Enter Counter B names, enter 'q' to end")
k=input()
while(k!='q'):
counterB.append(k)
k=input()

print(counterA)

print(counterB)

m=len(counterA)
n=len(counterB)
i=0
j=0
k=0
while(i<m or j<n):
while(k<2):
if(j<n):
temp_screening.append(counterB[j])
j+=1
k+=1
k=0
if(i<m):
temp_screening.append(counterA[i])
i+=1

print(temp_screening)

49 changes: 49 additions & 0 deletions December-11/python3_anusha_devulapally_jsql.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
path="https://raw.githubusercontent.com/anusha-devulapally/A-December-of-Algorithms-2020/main/src/assets/dec%2011%20sample%20input.json"

import requests
req=requests.get(path).json()
print(req)

table_name=req['table name']
table_name

headers=req['headers']
cols=len(headers)
head=[]
for i in range(1,cols+1):
head.append([headers[str(i)]['column name'],headers[str(i)]['data type']])
print(head)

records=req['records']
col=len(records)
rec=[]
for i in range(1,col+1):
rec.append(records[str(i)])

print(rec)

print("create table",end=' ')
print(table_name,end=' ')
print('(',end='')
for i in range(len(head)):
print(head[i][0],end=' ')
print(head[i][1],end='')
if(i<len(head)-1):
print(",",end=' ')
print(')',end=';')

for i in range(len(rec)):
print("insert into",end=' ')
print(table_name,end=' ')
print("values",end=' ')
print("(",end='')
for j in range(len(rec[i])):
if("varchar" in head[j][1]):
print('"{}"'.format(rec[i][j]),end='')
else:
print(rec[i][j],end='')
if(j<(len(rec[i])-1)):
print(",",end=' ')
print(")",end=';')
print()

55 changes: 55 additions & 0 deletions December-12/python3_anusha_devulapally_recruitement_drive.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
path="https://raw.githubusercontent.com/anusha-devulapally/A-December-of-Algorithms-2020/main/src/assets/RECRUITMENT%20DRIVE%20-%20Sheet1.csv"

import numpy as np
import pandas as pd
class LogitRegression() :
def __init__( self, learning_rate, iterations ) :
self.learning_rate = learning_rate
self.iterations = iterations
def fit( self, X, Y ) :
self.m, self.n = X.shape
self.W = np.zeros( self.n )
self.b = 0
self.X = X
self.Y = Y

# gradient descent learning

for i in range( self.iterations ) :
self.update_weights()
return self

def update_weights( self ) :
A = 1 / ( 1 + np.exp( - ( self.X.dot( self.W ) + self.b ) ) )
tmp = ( A - self.Y.T )
tmp = np.reshape( tmp, self.m )
dW = np.dot( self.X.T, tmp ) / self.m
db = np.sum( tmp ) / self.m

# update weights
self.W = self.W - self.learning_rate * dW
self.b = self.b - self.learning_rate * db

return self

def predict( self, X ) :
k=np.dot(X.T,self.W)+self.b
Z = 1 / ( 1 + np.exp(-(k)))
Y = np.where( Z > 0.5, 1, 0 )
return Y

def main() :
df = pd.read_csv(path)
X = df.iloc[:,:-1].values
Y = df.iloc[:,-1:].values
model = LogitRegression( learning_rate = 0.3, iterations = 1000 )
model.fit( X, Y )
x=list(map(float,input().split()))
x=np.array(x).reshape(-1,1)
y_pred2=model.predict(x)
if(y_pred2==1):
print("Selected")
else:
print("Not selected")
if __name__ == "__main__" :
main()
23 changes: 23 additions & 0 deletions December-13/python3_anusha_devulapally_Check_your_Spelling_Sara.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

correct_word=list(map(str,input().split()))

correct_word

misspelt_words=input()

def matchornot(correct,wrong):
m=len(correct)
n=len(wrong)
if(m!=n):
return 0
total=0
for i in range(m):
if(correct[i]!=wrong[i]):
total+=1
return total

for i in correct_word:
val=matchornot(i,misspelt_words)
if(val==1):
print(i)

Loading