You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -211,7 +211,7 @@ A **software** is a collection of programs where each program provides a sequenc
211
211
212
212
These instructions have to be provided in **machine language** or **low level language** (0s and 1s) that is difficult to read or write for a human being.
213
213
214
-
This led to the invention of **high-level programming languages** in which programs can be easily written and managed. The human-readable programs written using high-level languages are converted into computer-readable machine code or bytecode using **compilers** or **interpreters**.
214
+
This led to the invention of **high-level programming languages** in which programs can be easily written and managed. The human-readable programs written using high-level languages are converted into computer-readable machine code or byte-code using **compilers** or **interpreters**.
215
215
216
216
There are many high-level programming languages that are currently in wide use.
217
217
@@ -287,7 +287,7 @@ Python programmers also have at their disposal the vast ecosystem of more than 2
287
287
288
288
**6. Web Application Development**
289
289
290
-
Some of the most popular web development frameworks (django, flask, etc.) are written in Python. This coupled with the availablity of packages to connect to any database makes Python a great choice for web application development.
290
+
Some of the most popular web development frameworks (django, flask, etc.) are written in Python. This coupled with the availability of packages to connect to any database makes Python a great choice for web application development.
291
291
292
292
## Installing Python in Windows
293
293
@@ -2300,7 +2300,7 @@ Evaluate the expression
2300
2300
2301
2301
**Solution**
2302
2302
2303
-
Parantesized expression `(...)` has the highest precedence so `+` is evaluated first
2303
+
Parenthesized expression `(...)` has the highest precedence so `+` is evaluated first
2304
2304
`15 - (2 + 4)`
2305
2305
= `15 - 6`
2306
2306
= `9`
@@ -2725,7 +2725,7 @@ Exception handling is the process of properly handling an exception which can po
2725
2725
2726
2726
When an error occurs, the program throws an exception.
2727
2727
2728
-
The runtime system attempts to find an **exception handler**, a block of code that can handle a particular type of error. Once located, the suitable exception handler **catches the exeception** and executes the code block which can attempt to recover from the error. In case the error is unrecoverable, the handler provides a way to gently exit the program.
2728
+
The runtime system attempts to find an **exception handler**, a block of code that can handle a particular type of error. Once located, the suitable exception handler **catches the exception** and executes the code block which can attempt to recover from the error. In case the error is unrecoverable, the handler provides a way to gently exit the program.
2729
2729
2730
2730
The `try` statement in Python specifies the exception handlers and/or cleanup code for a code block.
2731
2731
@@ -2734,7 +2734,7 @@ The various parts of a try statement are:
2734
2734
-`try` block: The block of statements within which an exception might be thrown.
2735
2735
-`except` clause(s): One or more exception handlers. Each `except` clause handles a particular type of exception. In case an exception of a particular type occurs in the `try` block, the corresponding `except` clause code block is executed.
2736
2736
-`else` clause: An optional `else` clause can also be included after the last `except` block. In case no exception is raised, none of the `except` blocks are executed. In this case, the `else` code block is executed.
2737
-
-`finally` clause: An optional `finally` clause can be added at the end of the try statement which includes a block of statements that are executed regardless of whether or not any error occured inside the try block. This block is usually setup for code cleanup and closing all open file objects.
2737
+
-`finally` clause: An optional `finally` clause can be added at the end of the try statement which includes a block of statements that are executed regardless of whether or not any error occurred inside the try block. This block is usually setup for code cleanup and closing all open file objects.
2738
2738
2739
2739
Here's the general form of these statements:
2740
2740
@@ -3997,7 +3997,7 @@ It has to be noted that the method counts non-overlapping occurrences, so it doe
3997
3997
2
3998
3998
```
3999
3999
4000
-
In the above example, `ala` is counted twice as the first occurence is in `valh"ala"` and the next occurance is in `"ala"la`. Although `ala` can be located again in `al"ala"`, it overlaps with the occurance`"ala"la`, hence it is not counted.
4000
+
In the above example, `ala` is counted twice as the first occurrence is in `valh"ala"` and the next occurrence is in `"ala"la`. Although `ala` can be located again in `al"ala"`, it overlaps with the occurrence`"ala"la`, hence it is not counted.
4001
4001
4002
4002
### find()
4003
4003
@@ -4639,7 +4639,7 @@ If you do not wish to modify the existing list and create a new list with items
4639
4639
4640
4640
Python lists have a built-in `sort()` method which sorts the items in-place using `<` comparisons between items.
4641
4641
4642
-
The method also accepts 2 keyworded arguments:
4642
+
The method also accepts 2 key-worded arguments:
4643
4643
-`key` is used to specify a function which is called on each list element prior to making the comparisons.
4644
4644
-`reverse` is a boolean which specifies whether the list is to be sorted in descending order.
4645
4645
@@ -5481,7 +5481,7 @@ In case of a tuple, the modified tuple is actually a completely new tuple with c
5481
5481
5482
5482
The original tuple is not modified as it is immutable. But, as `t` is no longer pointing to the original tuple, it is freed from memory.
5483
5483
5484
-
Thus, it is recommended that instead of `+=`, `append()` and `extend()` methods should be employed to add new items programatically as it will raise an error in case the code is trying to modify a tuple.
5484
+
Thus, it is recommended that instead of `+=`, `append()` and `extend()` methods should be employed to add new items programmatically as it will raise an error in case the code is trying to modify a tuple.
5485
5485
5486
5486
```python
5487
5487
>>> l = ["Hi", "Ed", "Punk"]
@@ -5669,7 +5669,7 @@ This method accepts the following:
5669
5669
{'yr': 15, 18: True, 'name': 'Ed'}
5670
5670
```
5671
5671
5672
-
**3. Keyworded arguments**
5672
+
**3. Key-worded arguments**
5673
5673
5674
5674
```python
5675
5675
>>> d = {"yr": 20, 18: True}
@@ -7557,9 +7557,9 @@ print(d)
7557
7557
7558
7558
Once a function is defined in the Python interpreter, it can be called any number of times. But, these function definitions are lost upon exiting the interpreter.
7559
7559
7560
-
To solve this problem we can create a python script with the function definitions at the beginning of teh file, followed by the rest of the code which includes statements invoking the defined functions.
7560
+
To solve this problem we can create a python script with the function definitions at the beginning of the file, followed by the rest of the code which includes statements invoking the defined functions.
7561
7561
7562
-
But, this process is tedious and not managable as what makes user-defined functions powerful is that the programmer can - **Write once, and use many times**.
7562
+
But, this process is tedious and not manageable as what makes user-defined functions powerful is that the programmer can - **Write once, and use many times**.
7563
7563
7564
7564
Instead of repeating the function definition again and again for each new program, one can put all the function definitions in a file from which the required function can be imported and invoked either in script mode or interactive mode.
7565
7565
@@ -7746,6 +7746,6 @@ restaurant/
7746
7746
7747
7747
A package is simply the directory containing sub-packages and modules, but when this package or a collection of packages are made available for others to use (eg. via PyPI) it is known as a **library**.
7748
7748
7749
-
For example, `restaurant` can be called a library if it provides reusable codes to manage a restaurant and is built using multiple packages which handle the various aspects of a restaurant like human resource management, inventory management, order fulfilment and billing, etc.
7749
+
For example, `restaurant` can be called a library if it provides reusable codes to manage a restaurant and is built using multiple packages which handle the various aspects of a restaurant like human resource management, inventory management, order fulfillment and billing, etc.
7750
7750
7751
7751
One should note that the above definition is not strict and often the terms package and library are used interchangeably.
0 commit comments