diff --git a/IP_LP3_PYTHON_Aditi_Linge_2512/cc1.py b/IP_LP3_PYTHON_Aditi_Linge_2512/cc1.py new file mode 100644 index 0000000..b0e738b --- /dev/null +++ b/IP_LP3_PYTHON_Aditi_Linge_2512/cc1.py @@ -0,0 +1,5 @@ +a=int(input()) +b=int(input()) +print(a+b) +print(a-b) +print(a*b) diff --git a/IP_LP3_PYTHON_Aditi_Linge_2512/cc10.py b/IP_LP3_PYTHON_Aditi_Linge_2512/cc10.py new file mode 100644 index 0000000..d6c95bf --- /dev/null +++ b/IP_LP3_PYTHON_Aditi_Linge_2512/cc10.py @@ -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) diff --git a/IP_LP3_PYTHON_Aditi_Linge_2512/cc11.py b/IP_LP3_PYTHON_Aditi_Linge_2512/cc11.py new file mode 100644 index 0000000..638c7ba --- /dev/null +++ b/IP_LP3_PYTHON_Aditi_Linge_2512/cc11.py @@ -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]) + diff --git a/IP_LP3_PYTHON_Aditi_Linge_2512/cc2.py b/IP_LP3_PYTHON_Aditi_Linge_2512/cc2.py new file mode 100644 index 0000000..b5f45a4 --- /dev/null +++ b/IP_LP3_PYTHON_Aditi_Linge_2512/cc2.py @@ -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)) diff --git a/IP_LP3_PYTHON_Aditi_Linge_2512/cc3.py b/IP_LP3_PYTHON_Aditi_Linge_2512/cc3.py new file mode 100644 index 0000000..6881ce6 --- /dev/null +++ b/IP_LP3_PYTHON_Aditi_Linge_2512/cc3.py @@ -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=" ") + + + diff --git a/IP_LP3_PYTHON_Aditi_Linge_2512/cc4.py b/IP_LP3_PYTHON_Aditi_Linge_2512/cc4.py new file mode 100644 index 0000000..fe36493 --- /dev/null +++ b/IP_LP3_PYTHON_Aditi_Linge_2512/cc4.py @@ -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) + diff --git a/IP_LP3_PYTHON_Aditi_Linge_2512/cc5.py b/IP_LP3_PYTHON_Aditi_Linge_2512/cc5.py new file mode 100644 index 0000000..2cfc988 --- /dev/null +++ b/IP_LP3_PYTHON_Aditi_Linge_2512/cc5.py @@ -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)) + diff --git a/IP_LP3_PYTHON_Aditi_Linge_2512/cc6_poor.py b/IP_LP3_PYTHON_Aditi_Linge_2512/cc6_poor.py new file mode 100644 index 0000000..ffdd7e3 --- /dev/null +++ b/IP_LP3_PYTHON_Aditi_Linge_2512/cc6_poor.py @@ -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