From d2b7a88badaede8921cb769c25b2ec46d177ecb8 Mon Sep 17 00:00:00 2001 From: architgupta9807 Date: Mon, 25 Jun 2018 11:02:09 +0530 Subject: [PATCH 01/15] Create pallindrome --- pallindrome | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 pallindrome diff --git a/pallindrome b/pallindrome new file mode 100644 index 0000000..2826b49 --- /dev/null +++ b/pallindrome @@ -0,0 +1,24 @@ +s = [] +copy = "" +count = -1 +n = int(input("enter number of strings: ")) +for i in range(n): + s.append(input()) +for i in s: + if i == i[::-1]: + print("-1") + else: + for j in range(0,len(i)): + copy="" + for k in range(0,len(i)): + if k == j: + continue + copy+=i[k] + # print(copy) + count+=1 + if copy == copy[::-1]: + print(count) + break + else: + print("-1") + count = -1 From b4e116754757dd705129702545973e29f6244ae2 Mon Sep 17 00:00:00 2001 From: Gaurav Rawal <31179124+black0405@users.noreply.github.com> Date: Mon, 25 Jun 2018 11:13:16 +0530 Subject: [PATCH 02/15] pattern.py Simple Pattern --- pattern.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 pattern.py diff --git a/pattern.py b/pattern.py new file mode 100644 index 0000000..4abfad7 --- /dev/null +++ b/pattern.py @@ -0,0 +1,6 @@ +n = int(input("Enter a odd number for a beautiful pattern: ") +for i in range(n): + for j in range(n): + print(n-min(i,j,n-1-i,n-1-j),end="") + print() + From bde4345ad6d4914b84618884445c4c8e220f8740 Mon Sep 17 00:00:00 2001 From: Gaurav Rawal <31179124+black0405@users.noreply.github.com> Date: Mon, 25 Jun 2018 11:20:21 +0530 Subject: [PATCH 03/15] Update pattern.py --- pattern.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pattern.py b/pattern.py index 4abfad7..f87e793 100644 --- a/pattern.py +++ b/pattern.py @@ -1,4 +1,4 @@ -n = int(input("Enter a odd number for a beautiful pattern: ") +n = int(input("Enter a odd number for a beautiful pattern: ")) for i in range(n): for j in range(n): print(n-min(i,j,n-1-i,n-1-j),end="") From 9662290e7f3fe0c444acbab4440a8b67fa873277 Mon Sep 17 00:00:00 2001 From: Gaurav Rawal <31179124+black0405@users.noreply.github.com> Date: Mon, 25 Jun 2018 11:24:27 +0530 Subject: [PATCH 04/15] Update pattern.py Checking for odd number --- pattern.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pattern.py b/pattern.py index f87e793..f83f80e 100644 --- a/pattern.py +++ b/pattern.py @@ -1,6 +1,9 @@ -n = int(input("Enter a odd number for a beautiful pattern: ")) -for i in range(n): - for j in range(n): - print(n-min(i,j,n-1-i,n-1-j),end="") - print() +n = int(input("Enter an odd number for a beautiful pattern: ")) +if n%2 != 0: + for i in range(n): + for j in range(n): + print(n-min(i,j,n-1-i,n-1-j),end="") + print() +else + print("Not an odd number") From aa84e7f196c5cfe763408c82dea6104200331a5e Mon Sep 17 00:00:00 2001 From: Gaurav Rawal <31179124+black0405@users.noreply.github.com> Date: Mon, 25 Jun 2018 11:24:45 +0530 Subject: [PATCH 05/15] Update pattern.py --- pattern.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pattern.py b/pattern.py index f83f80e..19ab6d9 100644 --- a/pattern.py +++ b/pattern.py @@ -4,6 +4,6 @@ for j in range(n): print(n-min(i,j,n-1-i,n-1-j),end="") print() -else +else: print("Not an odd number") From 894b9454c4996502639e4a6fd849bb521b05c439 Mon Sep 17 00:00:00 2001 From: nishchay1902 <40267336+nishchay1902@users.noreply.github.com> Date: Mon, 25 Jun 2018 13:18:25 +0530 Subject: [PATCH 06/15] Add files via upload --- RegEx.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 RegEx.py diff --git a/RegEx.py b/RegEx.py new file mode 100644 index 0000000..155af25 --- /dev/null +++ b/RegEx.py @@ -0,0 +1,7 @@ +import re +n="981127588" +pattern = re.compile("[789]") +if pattern.match(n)!=None and len(n)==10: + print("Valid") +else: + print("Invalid") From 6c4ff3d313bbac3da65e701f84219dc6dffb0509 Mon Sep 17 00:00:00 2001 From: Jatin Katyal Date: Mon, 25 Jun 2018 13:20:03 +0530 Subject: [PATCH 07/15] npy and npz files added --- a.npy | Bin 0 -> 176 bytes ab.npz | Bin 0 -> 498 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 a.npy create mode 100644 ab.npz diff --git a/a.npy b/a.npy new file mode 100644 index 0000000000000000000000000000000000000000..70f4ed9ec1703cc6eb448185936881523dda777a GIT binary patch literal 176 zcmbR27wQ`j$;eQ~P_3SlTAW;@Zl$1ZlWC!@qoAIaUsO_*m=~X4l#&V(cT3DEP6dh= oXCxM+0{I$7Its>`ItsN4WCJcn1_)q+(#%kr1xm9*X*MVg0D$frhyVZp literal 0 HcmV?d00001 diff --git a/ab.npz b/ab.npz new file mode 100644 index 0000000000000000000000000000000000000000..01ca9b140826f860278dfcc062aa9eed1c9b1405 GIT binary patch literal 498 zcmWIWW@Zs#fB;2?JrhIwW&k-L%nHO6dU*wvll?+{10oq2${4EEQ&NkQi`1(SImM|!@#2icf>a=1!&paCN1;}M0>H%xaUBB_lxBv~ z0VqztIw$`!vePREgVR}{P6dS}2(UpYh5&CyCJ|=b;SN>C&;a&3I2O>gp!*l0WjBxs V_I-diE7(FNV9=!j1 Date: Mon, 25 Jun 2018 13:21:57 +0530 Subject: [PATCH 08/15] Delete RegEx.py --- RegEx.py | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 RegEx.py diff --git a/RegEx.py b/RegEx.py deleted file mode 100644 index 155af25..0000000 --- a/RegEx.py +++ /dev/null @@ -1,7 +0,0 @@ -import re -n="981127588" -pattern = re.compile("[789]") -if pattern.match(n)!=None and len(n)==10: - print("Valid") -else: - print("Invalid") From 95b03ab39ad5d9e3ac05a722298f70aaa23d8f04 Mon Sep 17 00:00:00 2001 From: nishchay1902 <40267336+nishchay1902@users.noreply.github.com> Date: Mon, 25 Jun 2018 13:25:48 +0530 Subject: [PATCH 09/15] Add files via upload --- Phone.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Phone.py diff --git a/Phone.py b/Phone.py new file mode 100644 index 0000000..3745eaf --- /dev/null +++ b/Phone.py @@ -0,0 +1,7 @@ +import re +n=input() +pattern = re.compile("[789]") +if pattern.match(n)!=None and len(n)==10: + print("Valid") +else: + print("Invalid") From d58f9ce4a53cd6907ccab4e18488126e762ee981 Mon Sep 17 00:00:00 2001 From: AyushRawat23 <37009268+AyushRawat23@users.noreply.github.com> Date: Mon, 25 Jun 2018 13:28:05 +0530 Subject: [PATCH 10/15] Add files via upload --- Qspace.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Qspace.py diff --git a/Qspace.py b/Qspace.py new file mode 100644 index 0000000..b3cbab9 --- /dev/null +++ b/Qspace.py @@ -0,0 +1,7 @@ +f=str(input("Name:")) +f=f+".txt" +f=open(f,'r') +y=str(f.read()) +l=[] +l=y.split(' ') +print(len(l)-1) \ No newline at end of file From 3cca78b286b815066c4207c8644212a48395dc35 Mon Sep 17 00:00:00 2001 From: Pranjal <39904690+pranjalrmcf7@users.noreply.github.com> Date: Mon, 25 Jun 2018 13:29:26 +0530 Subject: [PATCH 11/15] Create Class Inheritance --- Class | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Class diff --git a/Class b/Class new file mode 100644 index 0000000..6ceb27b --- /dev/null +++ b/Class @@ -0,0 +1,60 @@ +class Employee: + raise_amount = 1.02 + + def __init__(self,first,last,pay): + self.first = first + self.last = last + self.pay = pay + self.email = first + '.' + last +'@gmail.com' + + def fullname(self): + print(self.first ,self.last) + + def apply_raise(self): + self.pay = int(self.pay * self.raise_amount) + + +class Developer(Employee): + raise_amount = 1.10 + + def __init__(self,first,last,pay,prog_lang): + super().__init__(first,last,pay) + self.prog_lang = prog_lang + + +class Manager(Employee): + raise_amount = 1.05 + + def __init__(self,first,last,pay,employees): + super().__init__(first,last,pay) + self.employees = employees + + def add_emp(self,emp): + if emp not in self.employees: + self.employees.append(emp) + + def remove_emp(self,emp): + if emp in self.employees: + self.employees.remove(emp) + + def print_emp(self): + for emp in self.employees: + print(emp.fullname()) + + + +dev_1 = Developer('Pranjal','RMCF',140000,'Python') +dev_2 = Developer('James','Dean',115000,'Java') +dev_3 = Developer('Michael','Jackson',90000,'Ruby') +dev_4 = Developer('Daniel',"Radcliffe",85000,'C') + +mgr_1 = Manager('Steven','Spielberg',120000,[dev_1,dev_4]) +mgr_2 = Manager('James','Cameron',110000,[dev_2,dev_3]) + +#print(dev_1.email) +mgr_1.print_emp() +#mgr_1.add_emp(dev_3) +#mgr_1.print_emp() +#print(dev_4.prog_lang) +#print(isinstance(dev_4,Manager)) +#print(issubclass(Developer,Manager)) From 357c4d5d65e1fe7b3065a093fe4a37205176dd91 Mon Sep 17 00:00:00 2001 From: akshatpathak <40276612+akshatpathak@users.noreply.github.com> Date: Mon, 25 Jun 2018 18:08:25 +0530 Subject: [PATCH 12/15] Create biased coin simulator --- biased coin simulator | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 biased coin simulator diff --git a/biased coin simulator b/biased coin simulator new file mode 100644 index 0000000..65d0e41 --- /dev/null +++ b/biased coin simulator @@ -0,0 +1,8 @@ +import random +x=random.choice(['heads','tails']) +print(x) +y=random.random() +if y<0.6: + print('heads') +else: + print('tailsb') From b5541101c7ae05340a75ea8d2fe725498d3b1582 Mon Sep 17 00:00:00 2001 From: akshatpathak <40276612+akshatpathak@users.noreply.github.com> Date: Mon, 25 Jun 2018 19:28:06 +0530 Subject: [PATCH 13/15] Create diagonal elements --- diagonal elements | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 diagonal elements diff --git a/diagonal elements b/diagonal elements new file mode 100644 index 0000000..f6e265e --- /dev/null +++ b/diagonal elements @@ -0,0 +1,5 @@ +import numpy as np +a=np.array([[1,2,3],[5,6,7],[9,10,11]]) +print(a) +for i in range(3): + print(a[i,i],a[i,2-i]) From fdeedbcce5758c62ea4e5f396d2257ded1fe2065 Mon Sep 17 00:00:00 2001 From: kandharikarteek <40284914+kandharikarteek@users.noreply.github.com> Date: Mon, 25 Jun 2018 23:24:32 +0530 Subject: [PATCH 14/15] Add files via upload --- codes/check_cons_ones.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 codes/check_cons_ones.py diff --git a/codes/check_cons_ones.py b/codes/check_cons_ones.py new file mode 100644 index 0000000..24d469c --- /dev/null +++ b/codes/check_cons_ones.py @@ -0,0 +1,9 @@ +n=input('enter the binary number: ') +k=input('enter the value of K: ') +g=0 +l=int(k) +g='1'*l +if(g in n): + print("yes there are given no. of consecutive 1's in the binary number") +else: + print('NO') \ No newline at end of file From 67d0c50833830c2f59ceca3c9958e2a187ad94b8 Mon Sep 17 00:00:00 2001 From: Harmeet17 <39988248+Harmeet17@users.noreply.github.com> Date: Tue, 26 Jun 2018 02:28:54 -0700 Subject: [PATCH 15/15] New code --- New code | 1 + 1 file changed, 1 insertion(+) create mode 100644 New code diff --git a/New code b/New code new file mode 100644 index 0000000..ed3d52b --- /dev/null +++ b/New code @@ -0,0 +1 @@ +print('Hello-World')