Skip to content

Commit 0629654

Browse files
authored
Merge pull request #38 from karan28598/master
typo-fix
2 parents 1fbaee9 + 835cfb1 commit 0629654

File tree

6 files changed

+36
-34
lines changed

6 files changed

+36
-34
lines changed

python/03-Conditionals.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Output
2727
```
2828
Ankit studies harder than Siddharth
2929
```
30-
the indentattion here is the key and all the statements that are indented inside the for will be executed regardless of the condition
30+
The indentation here is the key and all the statements that are indented inside the 'if' will be executed regardless of the condition
3131

3232
## IF-Else
3333
* It is an extension to the if condition

python/04-loops.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<h1 align="center"> LOOPS </h1>
22

33
## Why LOOPS?
4-
* Loops make our life easier by making it easier for us to perform repetetive task without having to actually write the same piece of code again and again that many times
4+
* Loops make our life easier by making it easier for us to perform repetitive task without having to actually write the same piece of code again and again that many times
55

66
* That is it helps you to perform a task as many as times you require depending on the condition you specify
77

@@ -18,7 +18,7 @@
1818

1919
```python
2020
count=1 # initializes a counter variable equal to 1
21-
while(count<=10): # checks if value of counter is less than equal to 15 if yes then execute the below
21+
while(count<=10): # checks if value of counter is less than equal to 10 if yes then execute the below
2222
print(str(count)+") I will do my homework everyday")
2323
count=count+1 #increments the value of counter otherwise it will remain less than 10 forever and thus infinite loop
2424
print("Sorry")
@@ -52,7 +52,7 @@ Here one should take care of the fact that lines which are indented inside the w
5252
list=['Jofrey','Cersei','Walder Frey','Meryn Trant','The Red Woman','Beric Dondarrion','Thoros of Myr','Ilyn Payne','The Mountain','The Hound'] # initialize a list with some values
5353
for people in list: # assigns people a temporary value of elements in the list one by one and executes the code till all elemets in the list are iterated
5454
print(people) #prints the current value in the variable people each time
55-
print("-Arya Stark") # You know who is it but look out for the indentation
55+
print("-Arya Stark") # You know who it is but look out for the indentation
5656
```
5757
_Output_
5858
```
@@ -72,7 +72,7 @@ The Hound
7272

7373
### Implementation
7474
```python
75-
for x in range(1,11): #make a note of of the ending point of the list
75+
for x in range(1,11): #make a note of the ending point of the list
7676
print(x,"Mississippi") # x takes one by one each value in the range
7777
```
7878
_Output_

python/05-Strings.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
<h2>Introduction</h2>
44

5-
>Python has a built-in string class named "str" with many handy features (there is an older module named "string" which you should not use). Python strings are "immutable" which means they cannot be changed after they are created. Since strings can't be changed, we construct *new* strings as we go to represent computed values. So, for example the expression ('hello' + 'there') takes in the 2 strings 'hello' and 'there' and builds a new string 'hellothere'.</br>
5+
>Python has a built-in string class named "str" with many handy features (there is an older module named "string" which you should not use). Python strings are "immutable" which means they cannot be changed after they are created. Since strings can't be changed, we construct *new* strings as we go to represent computed values.
66
7-
>Characters in a string can be accessed using the standard [ ] syntax. Python uses zero-based indexing, so if str is 'hello' str[1] is 'e'. If the index is out of bounds for the string, Python raises an error. The Python style (unlike Perl) is to halt if it can't tell what to do, rather than just make up a default value. The handy "slice" syntax (below) also works to extract any substring from a string. The len(string) function returns the length of a string. The [ ] syntax and the len() function actually work on any sequence type -- strings, lists, etc. Python tries to make its operations work consistently across different types. The '+' operator can concatenate two strings.</br>
7+
>So, for example the expression ('hello' + 'there') takes in the 2 strings 'hello' and 'there' and builds a new string 'hellothere'.
88
9-
>Notice in the code below that variables are not pre-declared -- just assign to them and go.</br>
9+
>Characters in a string can be accessed using the standard [ ] syntax. Python uses zero-based indexing, so if str is 'hello' str[1] is 'e'. If the index is out of bounds for the string, Python raises an error. The handy "slice" syntax (below) also works to extract any substring from a string. The len(string) function returns the length of a string. The [ ] syntax and the len() function actually work on any sequence type -- strings, lists, etc. Python tries to make its operations work consistently across different types. The '+' operator can concatenate two strings.
10+
11+
>Notice in the code below that variables are not pre-declared -- just assign to them and go.
1012
1113
_**Example**_
1214
```python
@@ -16,7 +18,7 @@ print len(s) ## 2
1618
print s + ' there' ## hi there
1719
```
1820

19-
>The str() function converts values to a string form so they can be combined with other strings.</br>
21+
>The str() function converts values to a string form so they can be combined with other strings.
2022
2123
_**Example**_
2224
```python
@@ -25,11 +27,9 @@ pi = 3.14
2527
text = 'The value of pi is ' + str(pi) ## yes
2628
```
2729

28-
>For numbers, the standard operators, +, /, * work in the usual way. There is no ++ operator, but +=, -=, etc. work. If you want integer division, it is most correct to use 2 slashes -- e.g. 6 // 5 is 1 (previous to python 3000, a single / does int division with ints anyway, but moving forward // is the preferred way to indicate that you want int division.)</br>
29-
3030
<h2>String Methods</h2>
3131

32-
>Here are some of the most common string methods. A method is like a function, but it runs "on" an object.</br>
32+
>Here are some of the most common string methods. A method is like a function, but it runs "on" an object.
3333
3434
<h2>Functions</h2>
3535

@@ -48,7 +48,7 @@ text = 'The value of pi is ' + str(pi) ## yes
4848

4949
<h2>String Slices</h2>
5050

51-
>The "slice" syntax is a handy way to refer to sub-parts of sequences -- typically strings and lists. The slice s[start:end] is the elements beginning at start and extending up to but not including end. Suppose we have s = "Hello"</br>
51+
>The "slice" syntax is a handy way to refer to sub-parts of sequences -- typically strings and lists. The slice s[start:end] is the elements beginning at start and extending up to but not including end. Suppose we have s = "Hello"
5252
5353
| <center>Function </center> | <center>What it does</center>
5454
| :------------- | :-------------
@@ -59,7 +59,7 @@ text = 'The value of pi is ' + str(pi) ## yes
5959

6060

6161

62-
>The standard zero-based index numbers give easy access to chars near the start of the string. As an alternative, Python uses negative numbers to give easy access to the chars at the end of the string: s[-1] is the last char 'o', s[-2] is 'l' the next-to-last char, and so on. Negative index numbers count back from the end of the string:</br>
62+
>The standard zero-based index numbers give easy access to chars near the start of the string. As an alternative, Python uses negative numbers to give easy access to the chars at the end of the string: s[-1] is the last char 'o', s[-2] is 'l' the next-to-last char, and so on. Negative index numbers count back from the end of the string:
6363
6464
| <center>Function </center> | <center>What it does</center>
6565
| :------------- | :-------------
@@ -72,15 +72,15 @@ text = 'The value of pi is ' + str(pi) ## yes
7272

7373
<h2>String %</h2>
7474

75-
>Python has a printf()-like facility to put together a string. The % operator takes a printf-type format string on the left (%d int, %s string, %f/%g floating point), and the matching values in a tuple on the right (a tuple is made of values separated by commas, typically grouped inside parentheses):</br>
75+
>Python has a printf()-like facility to put together a string. The % operator takes a printf-type format string on the left (%d int, %s string, %f/%g floating point), and the matching values in a tuple on the right (a tuple is made of values separated by commas, typically grouped inside parentheses):
7676
7777
_**Example**_
7878
```python
7979
## % operator
8080
text = "%d little pigs come out or I'll %s and %s and %s" % (3, 'huff', 'puff', 'blow down')
8181
```
8282

83-
>The above line is kind of long -- suppose you want to break it into separate lines. You cannot just split the line after the '%' as you might in other languages, since by default Python treats each line as a separate statement (on the plus side, this is why we don't need to type semi-colons on each line). To fix this, enclose the whole expression in an outer set of parenthesis -- then the expression is allowed to span multiple lines. This code-across-lines technique works with the various grouping constructs detailed below: ( ), [ ], { }.</br>
83+
>The above line is kind of long -- suppose you want to break it into separate lines. You cannot just split the line after the '%' as you might in other languages, since by default Python treats each line as a separate statement (on the plus side, this is why we don't need to type semi-colons on each line). To fix this, enclose the whole expression in an outer set of parenthesis -- then the expression is allowed to span multiple lines. This code-across-lines technique works with the various grouping constructs detailed below: ( ), [ ], { }.
8484
8585
_**Example**_
8686
```python

python/06-Lists.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<h1 align="center"> Lists </h1>
22

33
## What are lists ?
4-
> List is a collection in python. In most languages, it is called Array. We often need 'list' in our programs. Imagine you are writing a program to store name of every student in a class of 50 .
4+
> List is a collection in python. In most languages, it is called an Array. We often need 'list' in our programs. Imagine you are writing a program to store the name of every student in a class of 50 .
55
66
> Elements in a list are stored in sequential order . Every element can be accessed by their index value .
77
@@ -24,23 +24,23 @@ player_scores = [ 78, 103, 200 , 57] # >>> Initialized list with Integers
2424
player_names = [ "Karan" , "Chirag" , "Jay" , "Raj" ] # Initialized list with strings
2525
```
2626

27-
> Unlike other programming languages , in python we can Initialized or store elements in a list which are of different datatypes . For example,
27+
> Unlike other programming languages , in python we can Initialize or store elements which are of different datatypes in the same list. For example,
2828
2929
```python
3030

3131
unknown_list = [ "google", "tensorflow", 73 , 37.5 ] # works :P
3232

33-
print("Number of elements : "len(unknown_list)) # >>> Number of elements : 4
33+
print("Number of elements :", len(unknown_list)) # >>> Number of elements : 4
3434

3535
```
3636

3737
### Adding elements to the list
3838

3939
> We can add elements to the list by using append & insert methods .
4040
41-
* Insert( index , element) - We use this method to add elements to a specific postion in a list .
41+
* Insert(index , element) - We use this method to add elements to a specific postion in a list .
4242

43-
* append( element ) - We use this method to add elements to the back( last postion ) of the list .
43+
* append(element) - We use this method to add elements to the back(last postion) of the list .
4444

4545
```python
4646
scores = [ 1, 2 , 3 , 4 , 5 ] # Initialized list with Integers
@@ -135,10 +135,10 @@ _output_
135135
scores = [25, 89 , 90 , 45 , 87 ]
136136

137137
current = 0
138-
end = len(score)
138+
end = len(scores)
139139

140140
while current < end:
141-
print(scores[start])
141+
print(scores[current])
142142
current +=1
143143

144144
```
@@ -226,6 +226,6 @@ print(name_length) # >>> [6, 4 ,6 ,6]
226226
# list of squares
227227

228228
squares = [i*i for i in range(1,5)]
229-
print(squares) # >>> [1, 4 ,9 , 16 , 25]
229+
print(squares) # >>> [1, 4 ,9 , 16]
230230

231231
```

python/09-Inbuilt_functions.md

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<h1 align="center"><a href="#"> Strings </a></h1>
1+
<h1 align="center"><a href="#"> Inbuilt Functions </a></h1>
22

33
* The Python interpreter has a number of functions and types built into it that are always available.
4-
* There is no need to import modules extra in order to use them.
4+
* There is no need to import any extra modules in order to use them.
55
* A few functions that we will be covering here are-
66
* Map
77
* Filter
@@ -10,7 +10,7 @@
1010
* Reduce
1111

1212
## Map
13-
* It iterates through all the elements of a iterable and applies some specific funtion to each element of that iterable.
13+
* It iterates through all the elements of an iterable and applies some specific function to each element of that iterable.
1414
* With multiple iterables, the iterator stops when the shortest iterable is exhausted
1515

1616
### syntax
@@ -65,7 +65,7 @@ Output
6565
## Sort/Sorted
6666
* Python lists have a built-in sort() method that modifies the list in-place and a sorted() built-in function that builds a new sorted list from an iterable
6767
* There are many ways to use them to sort data and there doesn't appear to be a single, central place in the various manuals describing them
68-
* The key difference between both is that sorted returns a new list whereas sort chsnges the original list itself.
68+
* The key difference between both is that sorted returns a new list whereas sort changes the original list itself.
6969

7070
### syntax
7171
```python
@@ -78,7 +78,7 @@ sorted(list,key=<insert the key>)#sort in ascending order of the key set
7878
```python
7979

8080
a = [5, 2, 3, 1, 4]
81-
a.sort()# .sort() function is specific to lists
81+
a.sort() #sort() function is specific to lists
8282
print(a)
8383

8484
chir={2: 'D', 1: 'B', 4: 'B', 3: 'E', 5: 'A'}# declaring a dictionary
@@ -103,14 +103,14 @@ Output
103103
104104
```
105105
## max/min
106-
* Return the greatets/smallest item in an iterable or the smallest of two or more arguments.
106+
* Returns the greatest/smallest item in an iterable or the smallest of two or more arguments.
107107
* It can also be made to make use of key argument as used in sort function
108108
### implementation
109109
```python
110110
list = [1, 4, 3, 5,9,2]
111111
print(max(list)) #returns maximum value of list
112112
print(min(list)) #returns minimum value in the list
113-
print(max(list[2:-2])) #returns max value compined with slicing
113+
print(max(list[2:-2])) #returns max value combined with slicing
114114
print(min(list[4:])
115115
print(max(4,2,3,5))
116116
print(min(7,2,1,8,4))
@@ -121,13 +121,15 @@ Output
121121
1
122122
5
123123
9
124+
5
125+
1
124126

125127
```
126128

127129
## Reduce
128130
* Reduce is a really useful function for performing some computation on a list and returning the result.
129131
* It applies a rolling computation to sequential pairs of values in a list
130-
>note this not a inbuilt function as such because it needs to be imported from func tools but is pretty useful.
132+
>note this not an inbuilt function as such because it needs to be imported from func tools but is pretty useful.
131133

132134
### implementation
133135
```python

python/12-Modules.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The Python installers for the Windows platform usually include the [entire stand
88
* os - operating system interfaces
99

1010

11-
> In addition to the standard library, there is a growing collection of several thousand components (from individual programs and modules to packages and entire application development frameworks), available from [PyPI](https://pypi.python.org/pypi) , which you are free to explore after getting comfortable using some of th built in modules .
11+
> In addition to the standard library, there is a growing collection of several thousand components (from individual programs and modules to packages and entire application development frameworks), available from [PyPI](https://pypi.python.org/pypi) , which you are free to explore after getting comfortable using some of the built in modules .
1212
1313
### How do we use them ?
1414
> We can import modules which are available under [standard library](https://docs.python.org/3/library/index.html) by using _from_ , _as_ and _import_ keyword .
@@ -94,7 +94,7 @@ print(sample([10, 20, 30, 40, 50], k=4)) # >>> [30, 40, 20, 50]
9494
9595
```python
9696
import os
97-
#changs current working directory to test directory inside current directory
97+
#changes current working directory to test directory inside current directory
9898
os.chdir("./test")
9999

100100
os.getlogin() # >>> 'Nishchith'

0 commit comments

Comments
 (0)