From f0bd109a20ca2c195fedc0c2453afe49965e88f4 Mon Sep 17 00:00:00 2001 From: abregman Date: Mon, 21 Oct 2019 18:05:32 +0300 Subject: [PATCH] Add a couple of Python questions --- README.md | 55 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c983cc5..2c53422 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ :information_source:  This repository contains interview questions on various DevOps related topics -:bar_chart:  There are currently **330** questions +:bar_chart:  There are currently **338** questions :warning:  You don't need to know how to answer all the questions in this repo. DevOps is not about knowing all :) @@ -1521,8 +1521,11 @@ Swarm management which means you can create new swarms in Docker Cloud. #### :baby: Beginner
-What data type supported in Python and which of them are mutable? - What function can you use to show that a certain data type is mutable?
+What are some characteristics of the Python programming language?
+
+ +
+What data types supported in Python and which of them are mutable? How can you show that a certain data type is mutable?
The mutable data types are: @@ -1538,10 +1541,12 @@ The immutable data types are: Tuple The id function can be used to check if a given variable is mutable or not. +For example if you set a variable this way x = 2 and then run the id function this way id(x) you will get an ID which will be different once you change the variable x (like x = x + 5). +With mutable types, like list, you can modify the variable and the id will stay the same. Try to define a list and then append an item to it.
-What is PEP8? Give an example of 5 style guidelines
+What is PEP8? Give an example of 3 style guidelines
PEP8 is a list of coding conventions and style guidelines for Python @@ -1554,16 +1559,30 @@ PEP8 is a list of coding conventions and style guidelines for Python 5. Use 4 spaces per indentation level
+
+Explain inheritance and how to use it in Python
+
+ +
+What is an exception? What types of exceptions are you familiar with?
+
+ +
+Explain Exception Handling and how to use it in Python
+
+
Write a program which will revert a string (e.g. pizza -> azzip)
``` -Shortest way is str[::-1] - -"Classic" way: +Shortest way is str[::-1] but not the most efficient. ```
+
+How to merge two sorted lists into one sorted list?
+
+
What _ is used for in Python?
@@ -1572,6 +1591,12 @@ Shortest way is str[::-1] 3. As a general purpose "throwaway" variable name. For example: x, y, _ = get_data() (x and y are used but since we don't care about third variable, we "threw it away").
+##### Algorithms Implementation + +
+Can you implement "binary search" in Python?
+
+ ##### Files
@@ -1602,7 +1627,7 @@ set([food for bro in x for food in bro['food']])
-What is List Comprehension? Is better than a typical loop? Why?
+What is List Comprehension? Is it better than a typical loop? Why? Can you demonstrate how to use it?
@@ -1632,7 +1657,19 @@ Shortest way is: my_string[::-1] but it doesn't mean it's the most
-What is a generator? Why using generators? +What is a generator? Why using generators?
+
+ +
+Explain the following types of methods and how to use them: + + * Static method + * Class method + * instance method
+
+ +
+How to reverse a list?
##### Time Complexity