Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions IP_LP3_PYTHON_Aditi_Linge_2512/cc1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
a=int(input())
b=int(input())
print(a+b)
print(a-b)
print(a*b)
18 changes: 18 additions & 0 deletions IP_LP3_PYTHON_Aditi_Linge_2512/cc10.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
def selection_sort(sort_list):
for i in range(len(sort_list)):
smallest_element = min(sort_list[i:])
index_of_smallest = sort_list.index(smallest_element)
sort_list[i], sort_list[index_of_smallest] = sort_list[index_of_smallest], sort_list[i]
#print('\nPASS :', i + 1, sort_list)
print (sort_list)



lst = []
size = int(input()) #size

for i in range(size):
elements = int(input()) #elements
lst.append(elements)

selection_sort(lst)
8 changes: 8 additions & 0 deletions IP_LP3_PYTHON_Aditi_Linge_2512/cc11.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from datetime import *
year=int(input())
month=int(input())
day=int(input())
inp=datetime(year,month,day)

print(datetime.date(inp).isocalendar()[1])

15 changes: 15 additions & 0 deletions IP_LP3_PYTHON_Aditi_Linge_2512/cc2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
year=int(input())
def check(year):
if((year%4==0) and (year%100!=0)):
return True
elif((year%100==0) and (year%400==0)):
return True
elif(year%400==0):
return True
else:
return False




print(check(year))
31 changes: 31 additions & 0 deletions IP_LP3_PYTHON_Aditi_Linge_2512/cc3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
n=int(input())
a=[]
count=0
unique_list=[]
#input of words
for i in range(0,n):
s=input()
a.append(s)



#count distinct words in list
for i in a:
if i not in unique_list:
unique_list.append(i)



res=[]
for i in unique_list:
res.append(a.count(i))



print(len(unique_list))

for i in res:
print(i,end=" ")



11 changes: 11 additions & 0 deletions IP_LP3_PYTHON_Aditi_Linge_2512/cc4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
a=int(input())
b=int(input())

c=max(a,b)
count=0
for i in range(1,c):
if(a%i==0 and b%i==0):
count=count+1

print(count)

36 changes: 36 additions & 0 deletions IP_LP3_PYTHON_Aditi_Linge_2512/cc5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
NO_OF_CHARS = 256


def toMutable(string):
List = []
for i in string:
List.append(i)
return List

def toString(List):
return ''.join(List)


def removeDups(string):
bin_hash = [0] * NO_OF_CHARS
ip_ind = 0
res_ind = 0
temp = ''
mutableString = toMutable(string)


while ip_ind != len(mutableString):
temp = mutableString[ip_ind]
if bin_hash[ord(temp)] == 0:
bin_hash[ord(temp)] = 1
mutableString[res_ind] = mutableString[ip_ind]
res_ind+=1
ip_ind+=1


return toString(mutableString[0:res_ind])


string = input()
print(removeDups(string))

56 changes: 56 additions & 0 deletions IP_LP3_PYTHON_Aditi_Linge_2512/cc6_poor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
e=input()
#not...poor then replace whole by good
res=e.split()
#a=str(res)

if (('not' in e) and (('poor' or 'poor?' or 'poor!' or 'poor,') in e)):
i_n=res.index("not")







if('poor?' in e):
i_p=res.index("poor?")
if(i_n<i_p):
res[i_n:i_p+1]=""
res.insert(i_n,'good?')


elif('poor!' in e):
i_p=res.index("poor!")
if(i_n<i_p):
res[i_n:i_p+1]=""
res.insert(i_n,'good!')


elif('poor,' in e):
i_p=res.index("poor,")
if(i_n<i_p):
res[i_n:i_p+1]=""
res.insert(i_n,'good,')

elif('poor' in e):
i_p=res.index("poor")
if(i_n<i_p):
res[i_n:i_p+1]=""
res.insert(i_n,'good')

#list comprehension for list_to_string
s=' '.join([str(i) for i in res])

#print(res)
print(s)

else:
print(e)








17 changes: 17 additions & 0 deletions IP_LP3_PYTHON_Aditi_Linge_2512/cc7.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
temp=int(input())
op=input(" C for Celsius and F for Fahrenheit")

def C_to_F(temp):
f=int(((9*temp)/5)+32)
print("{}°C is {} in Fahrenheit".format(temp,f))

def F_to_C(temp):
c=int(5*((temp-32)/9))
print("{}°F is {} in Celsius".format(temp,c))

if(op=='C'):
C_to_F(temp)

elif(op=='F'):
F_to_C(temp)

8 changes: 8 additions & 0 deletions IP_LP3_PYTHON_Aditi_Linge_2512/cc8.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
n=int(input())
def sum_o(n):
if n<1:
return 0
else:
return n+sum_o(n - 2)

print(sum_o(n))