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
Binary file not shown.
13 changes: 13 additions & 0 deletions IP_LP3_Python_Sheldon_Moonjelil_2482/code1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@


x=int(input("Enter 1st number: "))
y=int(input("Enter 2nd numberz: "))
if 1<=x<=10**10 and 1<=y<=10**10:
add=x+y
sub=x-y
product=x*y
print(add)
print(sub)
print(product)


21 changes: 21 additions & 0 deletions IP_LP3_Python_Sheldon_Moonjelil_2482/code10.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
def selectionSort(lst):
for i in range(len(lst)-1,0,-1):
maxpos=0
for position in range(1,i+1):
if lst[position]>lst[maxpos]:
maxpos = position

temp = lst[i]
lst[i] = lst[maxpos]
lst[maxpos] = temp

lst = []
n = int(input("Enter number of elements : "))
for i in range(0, n):
ele = int(input())

lst.append(ele)


selectionSort(lst)
print(lst)
8 changes: 8 additions & 0 deletions IP_LP3_Python_Sheldon_Moonjelil_2482/code11.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

import datetime
year=int(input("Ënter year in digits: "))
month=int(input("Ënter month in digits: "))
date=int(input("Ënter date in digits: "))
dt = datetime.date(year, month, date)
wk = dt.isocalendar()[1]
print("week is",wk)
12 changes: 12 additions & 0 deletions IP_LP3_Python_Sheldon_Moonjelil_2482/code2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@



def isLeap(y):
if y%4==0:
return True
if y%100==0:
return True
if y%400==0:
return True
return False
print(isLeap(int(input())))
16 changes: 16 additions & 0 deletions IP_LP3_Python_Sheldon_Moonjelil_2482/code3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@


n = int(input())
if 1<n<10**5:
word_list = []
word_dict = dict()

for i in range(n):
word = input()
if word not in word_dict:
word_list.append(word)
word_dict[word] = word_dict.get(word,0) + 1

print(len(word_list))
for word in word_list:
print(word_dict[word], end='')
18 changes: 18 additions & 0 deletions IP_LP3_Python_Sheldon_Moonjelil_2482/code4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@



a = int(input())

b = int(input())

def gcd(a, b):
if (a == 0):
return b;
return gcd(b%a, a);

if (a>0 and a<(10**12+1) and b>=1 and b<(10**12+1)):
count = 1
for i in range(2, gcd(a, b)+1):
if a%i==0 and b%i==0:
count = count+1
print(count)
18 changes: 18 additions & 0 deletions IP_LP3_Python_Sheldon_Moonjelil_2482/code5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@


def removeDuplicate(str, n):
index = 0
for i in range(0, n):
for j in range(0, i + 1):
if (str[i] == str[j]):
break

if (j == i):
str[index] = str[i]
index += 1

return "".join(str[:index])

str= input()
n = len(str)
print(removeDuplicate(list(str), n))
11 changes: 11 additions & 0 deletions IP_LP3_Python_Sheldon_Moonjelil_2482/code6.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@


def not_poor(str1):
snot = str1.find('not')
sbad = str1.find('poor')

if sbad > snot:
str1 = str1.replace(str1[snot:(sbad+4)], 'good')

return str1
print(not_poor('The lyrics is not that poor'))
16 changes: 16 additions & 0 deletions IP_LP3_Python_Sheldon_Moonjelil_2482/code7.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@


temp = input("Input temperature ")
degree = int(temp[:-1])
initial = temp[-1]

if initial.upper() == "C":
result = int(round((9 * degree) / 5 + 32))
print(temp,"is",result,"in Farhenheit")
elif initial.upper() == "F":
result = int(round((degree - 32) * 5 / 9))
print(temp,"is",result,"in Celsius")
else:
print("Input correct temperature")
quit()

8 changes: 8 additions & 0 deletions IP_LP3_Python_Sheldon_Moonjelil_2482/code8.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def sumInt(n):
if n <= 1:
return 0
else:
return n + sumInt(n - 2)

i=int(input())
print(sumInt(i))