# Uncategorized

1
Sep

### Free Elasticsearch eBooks

Below is the list of free ebooks on Elasticsearch, Kibana, ELK Stack, Lucene, Logstash with their download link curated from different sources. Hope, you will find them useful in preparing for Deep Learning. There are in different formats like mobi, epub and pdf. In case, you don’t have mobi or epub reader please download it separately to view those files. I expect you must be having pdf viewer.

If you would like to list your ebook free of cost or would like to contribute, do comment or reach out to us. Did you check about other free eBooks about:

31
Aug

### Free Deep Learning eBooks

Deep Learning is a subfield of Machine Learning which learns from example. It is highly used in driverless cars, sentiment analysis, credit scoring, fraud detection etc. Below is the list of free Deep Learning ebooks with their download link curated from different sources. Hope, you will find them useful in preparing for Deep Learning.

• TensorFlow for Deep Learning – From Linear Regression to Reinforcement Learning [Download]

If you would like to list your ebook free of cost or would like to contribute, do comment or reach out to us. Did you check about other free eBooks about:

24
Aug

### Quick Sort

Question:

Write a program to perform Quick sort on [85, 63, 0, 12, 47, 96, 52]

Program:

Explanation:

Quicksort is a divide and conquer algorithm. Quicksort first divides a large array into two smaller sub-arrays: the low elements and the high elements. Quicksort can then recursively sort the sub-arrays.

The steps are:

1. Pick an element, called a pivot, from the array.
2. Partitioning: reorder the array so that all elements with values less than the pivot come before the pivot, while all elements with values greater than the pivot come after it (equal values can go either way). After this partitioning, the pivot is in its final position. This is called the partition operation.
3. Recursively apply the above steps to the sub-array of elements with smaller values and separately to the sub-array of elements with greater values.

The base case of the recursion is arrays of size zero or one, which never need to be sorted.

Output:

21
Aug

### Sum of diagonal elements using Comprehension

Question:

Write a program to find the sum of diagonal elements in a matrix.

Program:

Explanation:

Comprehensions provide a concise way to create new set of elements that satisfy a given condition from an iterable. Here the iterable is the for loop looking for diagonal elements. The list thus formed is passed to sum which returns the sum of elements in the list.

Output:

18
Aug

### Sum of diagonal elements

Question:

Write a program to find the sum of diagonal elements

Program:

Explanation:

Diagonal elements are those where i=j, as in a, a etc.the for loop cheks every instant if i is equal to j, if true value of a[i][j] is incremented to sum.

Output:

17
Aug

### Length of a string

Question:

Write a program to find the length of a string without inbuilt function

Program:

Explanation:

The strlen function return 0 if the string is empty. Otherwise it adds one to the index position of it;s last element obtained by s.rindex.

Output:

16
Aug

### Transpose Two matrices in Python

Question:

Write a program to transpose two matrices

Program:

Explanation:

The transpose of a matrix is an operator which flips a matrix over its diagonal, that is it switches the row and column indices of the matrix by producing another matrix denoted as AT (also written A′, AtrtA or At). It is achieved by any one of the following equivalent actions:

• reflect A over its main diagonal (which runs from top-left to bottom-right) to obtain AT
• write the rows of A as the columns of AT
• write the columns of A as the rows of AT

Formally, the i th row, j th column element of AT is the j th row, i th column element of A: If A is an m × n matrix then AT is an n × m matrix.

Output:

5
Jul

Question:

Write a python program to generate passwords

Program:

Explanation:

Following are the criteria for creating a password:

1. At least 1 letter between [a-z]

2. At least 1 number between [0-9]

1. At least 1 letter between [A-Z]

3. At least 1 character from [$#@] 4. Minimum length of transaction password: 6 5. Maximum length of transaction password: 12 Output: 4 Jul ### Area of Rectangle using classes Question: Calculate area of a rectangle using classes Program: Explanation: A class rect is created with two breadth and length, and method area which tabulates the area of the rectangle. An object obj of class rect is created and used Output: 3 Jul ### Even numbers using list comprehension Question: Create a list of even numbers between 0 and 10 using list comprehension. Program: Explanation: List comprehensions provide a concise way to create lists. It consists of brackets containing an expression followed by a for clause, then zero or more for or if clauses. The expressions can be anything, meaning you can put in all kinds of objects in lists. List comprehensions provide a concise way to create new list of elements that satisfy a given condition from an iterable. Here the iterable prints out even numbers. Output: 2 Jul ### Prime Numbers within a range Question : Write a program to print prime numbers within a range Program: Explanation: A prime number is a number that is divisible only by itself and 1 (e.g. 2, 3, 5, 7, 11). Output: 1 Jul ### Difference between range() and xrange() Question: Write a program to show the difference between range() and xrange() function Program: Explanation: The variable holding the range created using range() uses so much memory compared to the variable created using xrange() The reason is that range creates a list holding all the values while xrange creates an object that can iterate over the numbers on demand. Eventhough the xrange is memory efficient, the price we have to pay for this efficieny is access time. The range variable created with range() will have a faster access time compare to the variable created with xrange() as it is entirely stored in the memory so it is readily available whereas the variable created with xrange() have to load its contents to memory ‘on demand’ only. So time efficiency is a drawback of xrange() Output: 30 Jun ### Tuple Operations Question: Perform the following operations on the below tuple (‘abc’, ‘def’, ‘ghi’, ‘jklm’, ‘nopqr’, ‘st’, ‘uv’, ‘wxyz’, ’23’, ‘s98’, ‘123’, ’87’) • prints the length of the tuple • Slicing • Reverse all items in the tuple • Removing whole tuple • Concatenate two tuples Program: Explanation: A tuple is a sequence of immutable Python objects. Tuples are sequences, just like lists. The differences between tuples and lists are, the tuples cannot be changed unlike lists and tuples use parentheses, whereas lists use square brackets. Output: 29 Jun ### Check Validity of Password Question: Write a program to check the validity of password input by users. Accept a sequence of comma separated passwords and check them according to the above criteria. Print the valid passwords Program: Explanation: Following are the criteria for checking the password: 1. At least 1 letter between [a-z] 2. At least 1 number between [0-9] 3. At least 1 letter between [A-Z] 4. At least 1 character from [$#@]
5. Minimum length of transaction password: 6
6. Maximum length of transaction password: 12

Output:

28
Jun

### Print Inverted Star Pattern

Question:

Write a program to print the following pattern

Program:

27
Jun

### Number Right angle Triangle Pattern

Question:

Print the below pattern

Program:

26
Jun

### Star Pyramid Triangle

Question:

Write a program to print the following pattern

Program:

25
Jun

### Remove duplicate number

Question:

With a given list [5,3,5,3,6,8,3,1,9,4,5,9,0,7], write a program to print this list after removing all duplicate values with original order reserved.

Program:

Explanation:

Set() function stores number of values without duplicate.

Output:

24
Jun

### Swap without third variable

Question :

Swap two variables without using a third temporary variable

Program:

Explanation:
Here num1, num2 acts as a tuple. Since tuples are mutable, the above assignment works perfectly well

Output:

23
Jun

### Distance travelled by Robot

Question:
A robot moves in a plane starting from the original point (0,0). The robot can move toward UP, DOWN, LEFT and RIGHT with a given steps. The trace of robot movement is shown as the following:
UP 5
DOWN 3
LEFT 3
RIGHT 2
The numbers after the direction are steps. Please write a program to compute the distance from current position after a sequence of movement and original point. If the distance is a float, then just print the nearest integer.
Example:
If the following tuples are given as input to the program:
UP 5
DOWN 3
LEFT 3
RIGHT 2
Then, the output of the program should be:

2

Program:

Explanation:

The distance formula is derived from the Pythagorean theorem. To find the distance between two points (x1,y1) and (x2,y2), all that you need to do is use the coordinates of these ordered pairs and apply the formula  d=​{(x2x1)2+(y2y1)​2}​.This formula is used to find the distance.

Output: