Skip to content

Commit bb179d6

Browse files
authored
Merge pull request iluwatar#1 from bregman-arie/master
Update
2 parents 00d5d41 + a6403ea commit bb179d6

File tree

1 file changed

+57
-10
lines changed

1 file changed

+57
-10
lines changed

README.md

Lines changed: 57 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ Stateful applications depend on the storage to save state and data, typically da
197197
</b></details>
198198

199199
<details>
200-
<summary>Describe the workflow of setting up some type of web server (Apache, IIS, Tomact, ...)</summary><br><b>
200+
<summary>Describe the workflow of setting up some type of web server (Apache, IIS, Tomcat, ...)</summary><br><b>
201201
</b></details>
202202

203203
<details>
@@ -3230,6 +3230,28 @@ Generally, every compiling process have a two steps.
32303230

32313231
<details>
32323232
<summary>Explain Exception Handling and how to use it in Python</summary><br><b>
3233+
3234+
**Exceptions:** Errors detected during execution are called Exceptions.
3235+
3236+
**Handling Exception:** When an error occurs, or exception as we call it, Python will normally stop and generate an error message.</br>
3237+
Exceptions can be handled using `try` and `except` statement in python.
3238+
3239+
**Example:** Following example asks the user for input until a valid integer has been entered. </br>
3240+
If user enter a non-integer value it will raise exception and using except it will catch that exception and ask the user to enter valid integer again.
3241+
3242+
3243+
```py
3244+
while True:
3245+
try:
3246+
a = int(input("please enter an integer value: "))
3247+
break
3248+
except ValueError:
3249+
print("Ops! Please enter a valid integer value.")
3250+
3251+
```
3252+
3253+
For more details about errors and exceptions follow this [https://docs.python.org/3/tutorial/errors.html](https://docs.python.org/3/tutorial/errors.html)
3254+
32333255
</b></details>
32343256

32353257
<details>
@@ -3247,14 +3269,35 @@ Generally, every compiling process have a two steps.
32473269
<details>
32483270
<summary>What is Lambda? How is it used?</summary><br><b>
32493271

3250-
Lambda is an anonymous function is known as a lambda function. This function can have any number of parameters but, can have just one statement.
3272+
A <code>lambda</code> expression is an 'anonymous' function, the differnce from a normal defined function using the keyword `def`` is the syntax and ussage.
3273+
3274+
The syntax is:
32513275

3252-
Example:
3276+
```lambda[parameters]: [expresion]```
3277+
3278+
**Examples:**
3279+
3280+
* A lambda function add 10 with any argument passed.
3281+
3282+
```py
3283+
x = lambda a: a + 10
3284+
print(x(10))
3285+
```
3286+
3287+
* An addition function
3288+
3289+
```py
3290+
addition = lambda x, y: x + y
3291+
print(addition(10, 20))
32533292
```
3254-
1 a = lambda x,y : x+y
3255-
2 print(a(5, 6))
3256-
Output: 11
3293+
3294+
* Squaring function
3295+
3296+
```py
3297+
square = lambda x : x ** 2
3298+
print(square(5))
32573299
```
3300+
Generally it is considered a bad practice under PEP 8 to asign a lambda expresion, they are meant to be used as parameters and inside of other defined functions.
32583301

32593302
</b></details>
32603303

@@ -3699,15 +3742,15 @@ Detailed answer can be found here: http://codingshell.com/python-all-string-perm
36993742
<details>
37003743
<summary>How to reverse a string? (e.g. pizza -> azzip)</summary><br><b>
37013744

3702-
Shortest way is:
3745+
The correct way is:
37033746

37043747
```
37053748
my_string[::-1]
37063749
```
37073750

3708-
But it doesn't mean it's the most efficient one. <br>
3751+
A more visual way is:<br>
3752+
<i>Careful: this is very slow</i>
37093753

3710-
The Classic way is:
37113754
```
37123755
def reverse_string(string):
37133756
temp = ""
@@ -4404,12 +4447,16 @@ git checkout HEAD~1 -- /path/of/the/file
44044447

44054448
<details>
44064449
<summary>What is the <code>.git</code> directory? What can you find there?</summary><br><b>
4450+
The <code>.git</code> folder contains all the information that is necessary for your project in version control and all the information about commits, remote repository address, etc. All of them are present in this folder. It also contains a log that stores your commit history so that you can roll back to history.
4451+
4452+
4453+
This info copied from [https://stackoverflow.com/questions/29217859/what-is-the-git-folder](https://stackoverflow.com/questions/29217859/what-is-the-git-folder)
44074454
</b></details>
44084455

44094456
<details>
44104457
<summary>What are some Git anti-patterns? Things that you shouldn't do</summary><br><b>
44114458

4412-
* Not waiting to long between commits
4459+
* Not waiting too long between commits
44134460
* Not removing the .git directory :)
44144461
</b></details>
44154462

0 commit comments

Comments
 (0)