From 8731782772e488c54395889de6a07b686fed14f9 Mon Sep 17 00:00:00 2001 From: harshitha2204 <30696277+harshitha2204@users.noreply.github.com> Date: Sun, 18 Mar 2018 03:32:33 -0500 Subject: [PATCH 01/10] Create 1_sum.py --- 1_sum.py | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 1_sum.py diff --git a/1_sum.py b/1_sum.py new file mode 100644 index 0000000..900a728 --- /dev/null +++ b/1_sum.py @@ -0,0 +1,5 @@ +sum=0 +for i in range(1,500): + if (i%5==0)and(i%7!=0): + sum=sum+i +print(sum) From 6194f164c97d5fdc2d511eafda487ea7ff30bd1c Mon Sep 17 00:00:00 2001 From: harshitha2204 <30696277+harshitha2204@users.noreply.github.com> Date: Sun, 18 Mar 2018 03:32:59 -0500 Subject: [PATCH 02/10] Create 2_area.py --- 2_area.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 2_area.py diff --git a/2_area.py b/2_area.py new file mode 100644 index 0000000..92a9856 --- /dev/null +++ b/2_area.py @@ -0,0 +1,4 @@ +area=6*8*10 +per=15 +newarea=area*((1+per/100)**3) +print( newarea) From cc5c7430e72a5f009367a0ede8736374c6eda05f Mon Sep 17 00:00:00 2001 From: harshitha2204 <30696277+harshitha2204@users.noreply.github.com> Date: Sun, 18 Mar 2018 03:33:32 -0500 Subject: [PATCH 03/10] Create 3_sort.py --- 3_sort.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 3_sort.py diff --git a/3_sort.py b/3_sort.py new file mode 100644 index 0000000..ecde32c --- /dev/null +++ b/3_sort.py @@ -0,0 +1,6 @@ +list2=['Potter','Fred','Greg','George','Voldemort','Sirius','Dumbledore'] +list1=['Ron','Hermione','Harry','Professor','Dobby','The House Elf','Potter','Granger','Lockhart','Weasly'] +print(sorted(list1)+list2) + + + From 42bc1630e9ed6ff3c817aaf32faed6a27503b425 Mon Sep 17 00:00:00 2001 From: harshitha2204 <30696277+harshitha2204@users.noreply.github.com> Date: Sun, 18 Mar 2018 03:34:25 -0500 Subject: [PATCH 04/10] Create 4_pythagorean_triplet.py --- 4_pythagorean_triplet.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 4_pythagorean_triplet.py diff --git a/4_pythagorean_triplet.py b/4_pythagorean_triplet.py new file mode 100644 index 0000000..75cf0a6 --- /dev/null +++ b/4_pythagorean_triplet.py @@ -0,0 +1,7 @@ +for a in range(1,1000): + for b in range(a+1,1000): + c=1000-(a+b) + if(a**2)+(b**2)==(c**2): + if a+b+c==1000: + print(a*b*c) + break From 3bae54794d6a212af1a5a31b441af7c63fc54ef6 Mon Sep 17 00:00:00 2001 From: harshitha2204 <30696277+harshitha2204@users.noreply.github.com> Date: Sun, 18 Mar 2018 03:35:32 -0500 Subject: [PATCH 05/10] Create 5_lcm.py --- 5_lcm.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 5_lcm.py diff --git a/5_lcm.py b/5_lcm.py new file mode 100644 index 0000000..649f379 --- /dev/null +++ b/5_lcm.py @@ -0,0 +1,12 @@ +def gcd(a,b): + while b: + a,b=b,a%b + return a + +def lcm(a,b): + return (a*b)//gcd(a,b) + +x=1 +for i in range(2,21): + x=lcm(x,i) +print(x) From 79860e25c8fc16218f4127c72d8e6ec775b42432 Mon Sep 17 00:00:00 2001 From: harshitha2204 <30696277+harshitha2204@users.noreply.github.com> Date: Sun, 18 Mar 2018 03:36:15 -0500 Subject: [PATCH 06/10] Create 6_prime.py --- 6_prime.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 6_prime.py diff --git a/6_prime.py b/6_prime.py new file mode 100644 index 0000000..3ef12ca --- /dev/null +++ b/6_prime.py @@ -0,0 +1,12 @@ +def isPrime(x): + for i in range(2,int(x**0.5)+1): + if(x%i==0): + return False + return True + +def printPrimes(n): + print("primes are") + for i in range(2,n+1): + if(isPrime(i)): + print(i) +printPrimes(9999) From 1ac9cf96f5bc4ed60d8b34211ba09ef0d4efc962 Mon Sep 17 00:00:00 2001 From: harshitha2204 <30696277+harshitha2204@users.noreply.github.com> Date: Sun, 18 Mar 2018 03:41:25 -0500 Subject: [PATCH 07/10] Create 7_palindrome.py --- 7_palindrome.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 7_palindrome.py diff --git a/7_palindrome.py b/7_palindrome.py new file mode 100644 index 0000000..5bc2883 --- /dev/null +++ b/7_palindrome.py @@ -0,0 +1,6 @@ +str1=input("enter a string:") +str1_rev=str(str1[::-1]) +if(str1==str1_rev): +print("palindrome") +else: +print("not a palindrome") From 84e91ea78a06c5c466e670675243b5a55f062f6b Mon Sep 17 00:00:00 2001 From: harshitha2204 <30696277+harshitha2204@users.noreply.github.com> Date: Sun, 18 Mar 2018 08:12:48 -0500 Subject: [PATCH 08/10] Update 2_area.py --- 2_area.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/2_area.py b/2_area.py index 92a9856..adc46d8 100644 --- a/2_area.py +++ b/2_area.py @@ -1,4 +1,5 @@ -area=6*8*10 -per=15 -newarea=area*((1+per/100)**3) -print( newarea) +l=6 +b=8 +h=10 +a=l*b*(1.15)**2 +print(a) From dcd9ee26cd18ab8b7e5bc8504f554a1d0f42209c Mon Sep 17 00:00:00 2001 From: harshitha2204 <30696277+harshitha2204@users.noreply.github.com> Date: Sun, 18 Mar 2018 11:25:43 -0500 Subject: [PATCH 09/10] Update 2_area.py --- 2_area.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/2_area.py b/2_area.py index adc46d8..a577b1b 100644 --- a/2_area.py +++ b/2_area.py @@ -1,5 +1,8 @@ l=6 -b=8 +w=8 h=10 -a=l*b*(1.15)**2 +fl=1.15*6 +fw=1.15*8 +fh=1.15*10 +a=2*(fw*fh+fh*fl+fl*fw) print(a) From c50c23700bfdb820ddfeb3e5ad8e1675fdcb2367 Mon Sep 17 00:00:00 2001 From: harshitha2204 <30696277+harshitha2204@users.noreply.github.com> Date: Sun, 18 Mar 2018 11:29:39 -0500 Subject: [PATCH 10/10] Update 2_area.py