From c542fb549b2eeea687ccd5b263ee1565b5167c5b Mon Sep 17 00:00:00 2001 From: prajwal27 Date: Mon, 21 May 2018 05:24:53 -0700 Subject: [PATCH 1/2] a --- prajwalsb/Week-2/PrajwalSB/alternate.py | 12 ++++++++++++ prajwalsb/Week-2/PrajwalSB/pattern.py | 18 ++++++++++++++++++ prajwalsb/Week-2/PrajwalSB/sort.py | 14 ++++++++++++++ prajwalsb/Week-2/PrajwalSB/theory.txt | 17 +++++++++++++++++ 4 files changed, 61 insertions(+) create mode 100644 prajwalsb/Week-2/PrajwalSB/alternate.py create mode 100644 prajwalsb/Week-2/PrajwalSB/pattern.py create mode 100644 prajwalsb/Week-2/PrajwalSB/sort.py create mode 100644 prajwalsb/Week-2/PrajwalSB/theory.txt diff --git a/prajwalsb/Week-2/PrajwalSB/alternate.py b/prajwalsb/Week-2/PrajwalSB/alternate.py new file mode 100644 index 0000000..8eb38b2 --- /dev/null +++ b/prajwalsb/Week-2/PrajwalSB/alternate.py @@ -0,0 +1,12 @@ +n= int(input("Enter: ")) +lists=[] +for i in range(0,n): + x=int(input()) + lists.append(x) +print(len(lists)) +print("original list") +print(lists) +print("new list") +for i in range(1,n,2): + del lists[(i+1)//2] +print(lists) diff --git a/prajwalsb/Week-2/PrajwalSB/pattern.py b/prajwalsb/Week-2/PrajwalSB/pattern.py new file mode 100644 index 0000000..7fedfbf --- /dev/null +++ b/prajwalsb/Week-2/PrajwalSB/pattern.py @@ -0,0 +1,18 @@ +n= int(input("Enter: ")) +for i in range(1,(n+1)): + for j in range(n,i,-1): + print(" ",end="") + for k in range(1,i): + print("* ",end="") + for l in range(0,i): + print("* ",end="") + print() + +for i in range(n-1,0,-1): + for j in range(0,n-i): + print(" ",end="") + for k in range(1,(i*2)): + print("* ",end="") + print() + + diff --git a/prajwalsb/Week-2/PrajwalSB/sort.py b/prajwalsb/Week-2/PrajwalSB/sort.py new file mode 100644 index 0000000..b283b74 --- /dev/null +++ b/prajwalsb/Week-2/PrajwalSB/sort.py @@ -0,0 +1,14 @@ +n= int(input("Enter: ")) +lists=[] +for i in range(0,n): + x=int(input()) + lists.append(x) + +for i in range(0,n-1): + for j in range(0,n-1-i): + if lists[j] > lists[j+1]: + temp =lists[j] + lists[j]=lists[j+1] + lists[j+1]=temp + +print(lists) diff --git a/prajwalsb/Week-2/PrajwalSB/theory.txt b/prajwalsb/Week-2/PrajwalSB/theory.txt new file mode 100644 index 0000000..6c7418f --- /dev/null +++ b/prajwalsb/Week-2/PrajwalSB/theory.txt @@ -0,0 +1,17 @@ +Pros of python-- +easy to write the source code when compared with other languages. +easily readable and understandable for a non-programmer. +has a rich built-in and open source library +useful for asynchronous codes. + +Cons of python--- +since its an interpreted language, its slower than many other languages +it isn't used much in web browser and mobile computing +Because the language is dynamically typed, it requires more testing and has errors + +The exponential operator has the highest priority in expression. + +// is called floor division operator.division that results into whole number adjusted to the left in the number line +ex: 5//3 will give 1 , 5/3 will give 1.6666667 + 6//3 will give 2, 6/3 will give 2.0 + From 4699bd65834d1b36f47eccf9ccdf46c814ba14b8 Mon Sep 17 00:00:00 2001 From: prajwal27 Date: Thu, 24 May 2018 06:08:58 -0700 Subject: [PATCH 2/2] assignment4 --- .../Week-4/Prajwal/reversing/input.txt | 3 +++ .../Week-4/Prajwal/reversing/output.txt | 2 ++ .../Week-4/Prajwal/reversing/reverse.py | 23 +++++++++++++++++++ .../Week-4/Prajwal/theory5.txt | 13 +++++++++++ 4 files changed, 41 insertions(+) create mode 100644 Introduction-to-Data-Science/Week-4/Prajwal/reversing/input.txt create mode 100644 Introduction-to-Data-Science/Week-4/Prajwal/reversing/output.txt create mode 100644 Introduction-to-Data-Science/Week-4/Prajwal/reversing/reverse.py create mode 100644 Introduction-to-Data-Science/Week-4/Prajwal/theory5.txt diff --git a/Introduction-to-Data-Science/Week-4/Prajwal/reversing/input.txt b/Introduction-to-Data-Science/Week-4/Prajwal/reversing/input.txt new file mode 100644 index 0000000..8ecb8d9 --- /dev/null +++ b/Introduction-to-Data-Science/Week-4/Prajwal/reversing/input.txt @@ -0,0 +1,3 @@ +hello +i +am diff --git a/Introduction-to-Data-Science/Week-4/Prajwal/reversing/output.txt b/Introduction-to-Data-Science/Week-4/Prajwal/reversing/output.txt new file mode 100644 index 0000000..31899b5 --- /dev/null +++ b/Introduction-to-Data-Science/Week-4/Prajwal/reversing/output.txt @@ -0,0 +1,2 @@ +babe +hel diff --git a/Introduction-to-Data-Science/Week-4/Prajwal/reversing/reverse.py b/Introduction-to-Data-Science/Week-4/Prajwal/reversing/reverse.py new file mode 100644 index 0000000..17639de --- /dev/null +++ b/Introduction-to-Data-Science/Week-4/Prajwal/reversing/reverse.py @@ -0,0 +1,23 @@ +file=open("input.txt",'r+') +last=file.seek(0,2) +lis=[0] +ctr=0 +file.seek(0,0) +i=0 +while i