From 24b8d29b8a80af5994711ecd6e8551ae59e76e49 Mon Sep 17 00:00:00 2001 From: Sagor Sarker Date: Mon, 20 Jan 2020 15:37:19 +0600 Subject: [PATCH 1/8] added answer under 'Git/what is .git directory?' --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index cc0d44e..a664203 100644 --- a/README.md +++ b/README.md @@ -4394,6 +4394,10 @@ git checkout HEAD~1 -- /path/of/the/file
What is the .git directory? What can you find there?
+ The .git 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. + + +This info copied from [https://stackoverflow.com/questions/29217859/what-is-the-git-folder](https://stackoverflow.com/questions/29217859/what-is-the-git-folder)
From ee1870baff9ed3f947c95ee2769ce20b2dad0b85 Mon Sep 17 00:00:00 2001 From: Sagor Sarker Date: Mon, 20 Jan 2020 19:20:31 +0600 Subject: [PATCH 2/8] added answer under Python/Explain Exception.... --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index a664203..bcf55ff 100644 --- a/README.md +++ b/README.md @@ -3230,6 +3230,29 @@ Generally, every compiling process have a two steps.
Explain Exception Handling and how to use it in Python
+ +**Exceptions:** Errors detected during execution are called Exceptions. + +**Handling Exception:** When an error occurs, or exception as we call it, Python will normally stop and generate an error message.
+Exceptions can be handled using `try` and `except` statement in python. + +**Example:** Following example asks the user for input until a valid integer has been entered.
+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. + + +```py +while True: + try: + a = int(input("please enter an integer value: ")) + print(a) + break + except: + print("Ops! Please enter a valid integer value.") + +``` + +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) +
From 89aa001497c9b1b1e2d546737d52e153f1859643 Mon Sep 17 00:00:00 2001 From: surister Date: Mon, 20 Jan 2020 16:17:46 +0100 Subject: [PATCH 3/8] Add details in python answer about error handling. --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index bcf55ff..fde2c61 100644 --- a/README.md +++ b/README.md @@ -3244,9 +3244,8 @@ If user enter a non-integer value it will raise exception and using except it wi while True: try: a = int(input("please enter an integer value: ")) - print(a) break - except: + except ValueError: print("Ops! Please enter a valid integer value.") ``` From 7b7e78e2f72b3c67431d7de74426a7dd055df3d2 Mon Sep 17 00:00:00 2001 From: Sagor Sarker Date: Wed, 22 Jan 2020 14:43:32 +0600 Subject: [PATCH 4/8] update answer under Python/lambda --- README.md | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 92c0526..e75ea66 100644 --- a/README.md +++ b/README.md @@ -3269,15 +3269,36 @@ For more details about errors and exceptions follow this [https://docs.python.or
What is Lambda? How is it used?
-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. +A lambda expression is an 'anonymous' function, the differnce between a normal defined function using the keyword `def`` is the syntax and ussage. -Example: +The syntax is: + +```lambda[parameters]: [expresion]``` + +**Examples:** + +* A lambda function add 10 with any argument passed. + +```py +x = lambda a: a + 10 +print(x(10)) ``` -1 a = lambda x,y : x+y -2 print(a(5, 6)) -Output: 11 + +* An addition function + +```py +addition = lambda x, y: x + y +print(addition(10, 20)) ``` +* Squaring function + +```py +square = lambda x : x ** 2 +print(square(5)) +``` +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. +
#### Properties From e8fad188f33b324d768b37a033fdca54f20313f5 Mon Sep 17 00:00:00 2001 From: surister Date: Wed, 22 Jan 2020 10:14:55 +0100 Subject: [PATCH 5/8] Fix wording Fix wording from'between' to 'from' --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e75ea66..e7e5541 100644 --- a/README.md +++ b/README.md @@ -3269,7 +3269,7 @@ For more details about errors and exceptions follow this [https://docs.python.or
What is Lambda? How is it used?
-A lambda expression is an 'anonymous' function, the differnce between a normal defined function using the keyword `def`` is the syntax and ussage. +A lambda expression is an 'anonymous' function, the differnce from a normal defined function using the keyword `def`` is the syntax and ussage. The syntax is: From fd2a1859d76eb0f3c9f3fe04c4799b32f5e58a24 Mon Sep 17 00:00:00 2001 From: bayangan1991 Date: Fri, 24 Jan 2020 14:46:00 +1100 Subject: [PATCH 6/8] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e7e5541..2e9b935 100644 --- a/README.md +++ b/README.md @@ -3742,15 +3742,15 @@ Detailed answer can be found here: http://codingshell.com/python-all-string-perm
How to reverse a string? (e.g. pizza -> azzip)
-Shortest way is: +The correct way is: ``` my_string[::-1] ``` -But it doesn't mean it's the most efficient one.
+A more visual way is:
+Careful: this is very slow -The Classic way is: ``` def reverse_string(string): temp = "" From f046ca39e77e82ac72ffdc3d916de746dbbd08be Mon Sep 17 00:00:00 2001 From: LBlend <24893890+LBlend@users.noreply.github.com> Date: Fri, 24 Jan 2020 10:21:15 +0100 Subject: [PATCH 7/8] Fixed typo to -> too --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e7e5541..f170d30 100644 --- a/README.md +++ b/README.md @@ -4456,7 +4456,7 @@ This info copied from [https://stackoverflow.com/questions/29217859/what-is-the-
What are some Git anti-patterns? Things that you shouldn't do
- * Not waiting to long between commits + * Not waiting too long between commits * Not removing the .git directory :)
From a08e95b2c4739f3e2fcdd1aac4a4e6a9790b2a1c Mon Sep 17 00:00:00 2001 From: Carlos Azuaje Date: Fri, 24 Jan 2020 14:29:34 -0300 Subject: [PATCH 8/8] typographical error, tomcat Tomact -> Tomcat --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f170d30..3aebe6c 100644 --- a/README.md +++ b/README.md @@ -197,7 +197,7 @@ Stateful applications depend on the storage to save state and data, typically da
-Describe the workflow of setting up some type of web server (Apache, IIS, Tomact, ...)
+Describe the workflow of setting up some type of web server (Apache, IIS, Tomcat, ...)