diff --git a/IP_LP3_Python_Sheldon_Moonjelil_2482/PROBLEM STATEMENT PYTHON (1).pdf b/IP_LP3_Python_Sheldon_Moonjelil_2482/PROBLEM STATEMENT PYTHON (1).pdf new file mode 100644 index 0000000..6220298 Binary files /dev/null and b/IP_LP3_Python_Sheldon_Moonjelil_2482/PROBLEM STATEMENT PYTHON (1).pdf differ diff --git a/IP_LP3_Python_Sheldon_Moonjelil_2482/code1.py b/IP_LP3_Python_Sheldon_Moonjelil_2482/code1.py new file mode 100644 index 0000000..4c6b67d --- /dev/null +++ b/IP_LP3_Python_Sheldon_Moonjelil_2482/code1.py @@ -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) + + \ No newline at end of file diff --git a/IP_LP3_Python_Sheldon_Moonjelil_2482/code10.py b/IP_LP3_Python_Sheldon_Moonjelil_2482/code10.py new file mode 100644 index 0000000..49cef6c --- /dev/null +++ b/IP_LP3_Python_Sheldon_Moonjelil_2482/code10.py @@ -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) diff --git a/IP_LP3_Python_Sheldon_Moonjelil_2482/code11.py b/IP_LP3_Python_Sheldon_Moonjelil_2482/code11.py new file mode 100644 index 0000000..e1f488d --- /dev/null +++ b/IP_LP3_Python_Sheldon_Moonjelil_2482/code11.py @@ -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) \ No newline at end of file diff --git a/IP_LP3_Python_Sheldon_Moonjelil_2482/code2.py b/IP_LP3_Python_Sheldon_Moonjelil_2482/code2.py new file mode 100644 index 0000000..6964bc5 --- /dev/null +++ b/IP_LP3_Python_Sheldon_Moonjelil_2482/code2.py @@ -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()))) diff --git a/IP_LP3_Python_Sheldon_Moonjelil_2482/code3.py b/IP_LP3_Python_Sheldon_Moonjelil_2482/code3.py new file mode 100644 index 0000000..2b0e71f --- /dev/null +++ b/IP_LP3_Python_Sheldon_Moonjelil_2482/code3.py @@ -0,0 +1,16 @@ + + +n = int(input()) +if 10 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) \ No newline at end of file diff --git a/IP_LP3_Python_Sheldon_Moonjelil_2482/code5.py b/IP_LP3_Python_Sheldon_Moonjelil_2482/code5.py new file mode 100644 index 0000000..9c37067 --- /dev/null +++ b/IP_LP3_Python_Sheldon_Moonjelil_2482/code5.py @@ -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)) \ No newline at end of file diff --git a/IP_LP3_Python_Sheldon_Moonjelil_2482/code6.py b/IP_LP3_Python_Sheldon_Moonjelil_2482/code6.py new file mode 100644 index 0000000..07818b0 --- /dev/null +++ b/IP_LP3_Python_Sheldon_Moonjelil_2482/code6.py @@ -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')) diff --git a/IP_LP3_Python_Sheldon_Moonjelil_2482/code7.py b/IP_LP3_Python_Sheldon_Moonjelil_2482/code7.py new file mode 100644 index 0000000..de6841c --- /dev/null +++ b/IP_LP3_Python_Sheldon_Moonjelil_2482/code7.py @@ -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() + diff --git a/IP_LP3_Python_Sheldon_Moonjelil_2482/code8.py b/IP_LP3_Python_Sheldon_Moonjelil_2482/code8.py new file mode 100644 index 0000000..cd20eb2 --- /dev/null +++ b/IP_LP3_Python_Sheldon_Moonjelil_2482/code8.py @@ -0,0 +1,8 @@ +def sumInt(n): + if n <= 1: + return 0 + else: + return n + sumInt(n - 2) + +i=int(input()) +print(sumInt(i))