Skip to content

Commit fd8263d

Browse files
authored
Update README.md
1 parent 3302f34 commit fd8263d

File tree

1 file changed

+268
-3
lines changed

1 file changed

+268
-3
lines changed

README.md

+268-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,271 @@
1-
# Python-Programming
1+
# Python Programming
22

3-
All the codes here further information can be available at...
3+
Directing to the [Main Website](https://sites.google.com/view/gitam-2210416132-may-2019/home).
44

5-
https://sites.google.com/view/gitam-2210416132-may-2019/home
5+
# Contents:
66

7+
- [9th May2019](#9th-may2019)
8+
- [10th May2019](#10th-may-2019contents)
9+
- [12th May2019](# )
10+
- [14th May2019]
11+
- [15th May2019]
12+
- [16th May20190]
13+
---
14+
15+
## [9th May2019](#contents)
16+
17+
### Problem 1 :
18+
19+
Given 2 int values, return True if first parameter is negative and second parameter is positive or vice versa. Except if the third parameter is True, then return True only if first two parameters are negative.
20+
21+
**Test Cases**
22+
23+
pos_neg(1, -1, False) → True
24+
pos_neg(-1, 1, False) → True
25+
pos_neg(-4, -5, True) → True
26+
pos_neg(-1, 1, True) -> False
27+
pos_neg(1, 6, True) -> False
28+
pos_neg(-1, -9, False) -> False
29+
30+
### Problem 2 :
31+
32+
Create a Random Number Generator which takes the Range(lb, ub) and returns a Random number in the given range. lb < random number < ub
33+
34+
**Test Cases¶**
35+
36+
RandomGenerator(1, 100) -> will be in range (1,100)
37+
38+
### Problem 3 :
39+
40+
Given an integer N, calculate the sum of N random numbers in the range `[0, 1000000000000000)`
41+
42+
### Problem 4 :
43+
44+
Design a procedure to perform Linear search on list of N unsorted unique numbers. It take an array and the key element to be searched and returns the index of the element of key element if found. Else returns -1
45+
46+
**Test Cases**
47+
48+
linearSearch([1,4,8,0,3,5,6], 3) -> 4
49+
linearSearch([15, 12, 9, 6, 3, -3], 0) -> -1
50+
linearSearch([321, 543, 567, 789], 567) -> 2
51+
52+
### Problem 5 :
53+
54+
Procedure to generate multiplication tables.
55+
56+
### Problem 6:
57+
58+
Procedure to return the list of factors of a given number.
59+
60+
**Test Cases**
61+
62+
factorsList(6) -> [1, 2, 3, 6]
63+
factorsList(100) -> [1, 2, 4, 5, 10, 20, 25, 50, 100]
64+
factorsList(1) -> [1]
65+
66+
### Problem 7 :
67+
68+
Design a procedure to determine if a given string is a Palindrome
69+
70+
**Test Cases**
71+
72+
Palindrome("racecar") -> True
73+
Palindrome("python") -> False
74+
75+
---
76+
77+
## [10th May 2019](#contents)
78+
79+
1. Solve the following problems using Recursion and Iteration
80+
81+
- Power of a number
82+
- Factorial
83+
- GCD
84+
- Towers of Hanoi
85+
- Generating the nth Fibonacci number
86+
87+
2. Define a function to identity the number of times a substring is repeating in a given string
88+
89+
substringCount('str', 'substr') -> 1
90+
substringCount('1234567891122334455', '3') -> 3
91+
substringCount('abccddccc', 'cc') -> 3
92+
substringCount('aaaaaaa', 'aaa' ) -> 5
93+
94+
3. Define a function to merge the characters of two strings alternatively. The remaining characters of the longer string are printed in the same order at the end.
95+
96+
mergeString('abcd', 'abcd') -> 'aabbccdd'
97+
mergeString('abc', '123456') -> 'a1b2c3456'
98+
mergeString('0', '123456') -> '0123456'
99+
100+
4) Define a function to convert a binary number to the corresponding decimal number
101+
102+
binaryToDecimal(1100) -> 12
103+
binaryToDecimal(1010) -> 10
104+
binaryToDecimal(111000) -> 56
105+
106+
5) Define a function to convert a decimal number to the corresponding binary number
107+
108+
decimalToBinary(15) -> 1111
109+
decimalToBinary(1) -> 1
110+
111+
6. Define a function to check if a given year is a leap year. Returns a boolean value
112+
113+
2000 -> True
114+
1900 -> False
115+
2012 -> True
116+
2020 -> True
117+
0200 -> False
118+
119+
7. Design a Python script to determine the difference in date for given two dates in YYYY:MM:DD format(0 <= YYYY <= 9999, 1 <= MM <= 12, 1 <= DD <= 31) following the leap year rules. Return the total number of days existing between the two dates.
120+
121+
dateDifference('2019:05:10', '2019:05:01') -> 9
122+
dateDifference('0003:03:03', '0003:06:06') -> 95
123+
dateDifference('0001:03:27', '0001:06:03') -> 68
124+
125+
8. Define a function to find the average of all the outer elements of an N x M matrix.
126+
127+
averageOuterMatrix([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]] -> 4.5
128+
129+
9. Define a function to print the sequence of spiral pattern elements for a given N x N matrix
130+
131+
spiralPattern([[1,2,3], [4,5,6], [7,8,9]]) -> 1 2 3 6 9 8 7 4 5
132+
133+
---
134+
135+
### [12 May 2019](#contents)
136+
137+
**1. Problem Statement:**
138+
139+
You are given n words. Some words may repeat. For each word, output its number of occurrences. The output order should correspond with the input order of appearance of the word.
140+
141+
First line of input contains the total number of words n. Next n lines contain words that need to processed.
142+
143+
First line of the output should contain the total number distinct words. Second line of output must contain the frequency of words the same order of their appearance as in the input
144+
145+
**Sample Input :** 6
146+
147+
abcd
148+
ijkl
149+
abcd
150+
pqrs
151+
abcd
152+
ijkl
153+
154+
**Sample Output :** 3
155+
156+
3 2 1
157+
158+
2 . **Problem Statement:** Define a function to validate email addresses based on the following rules.
159+
160+
- Email should be in the format `username@domain.extension` username must start with an alphabet and can contain lowercase alphabet, digits, hyphen(-) and underscores( \_ ).
161+
username must not contain special characters, uppercase letters, whitespaces.
162+
- Length of username must be in the range (6, 16)
163+
- Domain can only contain lowercase alphabet and digits with length in range (3, 10) . No special characters are allowed
164+
- Extension can only contain lower case alphabet and its length must be in the range (2, 4)
165+
166+
**Constraints:**
167+
First line of input contains total number of email addresses n. Next n lines contain n email addresses.
168+
169+
Output must contain contain n lines with either 'Valid' or 'Invalid'
170+
171+
**Sample Input :** 6
172+
173+
abc456@gmail.com
174+
456abc@yahoo.com
175+
abc_456@gitam.ed1
176+
abc-456@abc-d.in
177+
python@python.edu
178+
abc 456@edu.edu
179+
180+
**Sample Output :** Valid
181+
182+
Invalid
183+
Invalid
184+
Invalid
185+
Valid
186+
Invalid
187+
188+
3 .**Problem Statement:** Define a function that take an array of integers A, and an integer K and returns the longest possible sub-set of A i.e A' such that the sum of no two elements in A' is divisible by K.
189+
190+
**Constraints:**
191+
First line in input contains the length of A and the integer K. Second line of input contains len(A) space-separated integers.
192+
193+
Output must contain the length of A' list
194+
195+
**Sample Input :** 4 3
196+
197+
1 7 2 4
198+
199+
**Sample Output :** 3
200+
201+
---
202+
203+
## [14 May 2019](#contents)
204+
205+
### Hackathon - Phase 1
206+
207+
**Problem Statement-1:** For a given integer N, find the total number of Non - Prime Factors in the range (1, N) (both exclusive) that do not contain the digit 0
208+
209+
nonPrimeFactorsCount( 100 ) -> 2
210+
nonPrimeFactorsCount( 50 ) -> 1
211+
212+
**Problem Statement-2:** For a given integer N. Find the least positive integer X made up of only 9's and 0's, such that, X is a multiple of N.
213+
214+
X is made up of one or more occurrences of 9 and zero or more occurrences of 0.
215+
216+
Multiple( 5 ) -> 90
217+
Multiple ( 7 ) -> 9009
218+
Multiple( 1 ) -> 9
219+
220+
---
221+
222+
## [15 May 2019](#contents)
223+
224+
**Topics:**
225+
226+
- Python Packages and Modules
227+
- Regular Expressions
228+
- Iterators and Generators
229+
230+
---
231+
232+
## [16 May 2019](#contents)
233+
234+
**Topics:**
235+
236+
- File Handling / Data Processing
237+
- Functional Programming
238+
- External Libraries
239+
240+
---
241+
242+
## [17 May 2019](#contents)
243+
244+
**Topics:**
245+
246+
- Numpy library for N-dimensional Array operations
247+
- Pandas library for Data Analysis
248+
- Data Processing of CSV files
249+
250+
---
251+
252+
## [18 May 2019](#contents)
253+
254+
**Topics:**
255+
256+
- **Matplotlib** library for Data Visualization
257+
1. Line Plots
258+
2. Bar Graphs
259+
3. Scatter Plot
260+
4. Histograms
261+
5. Pie Charts
262+
263+
---
264+
265+
## [19 May 2019](#contents)
266+
267+
**Problem statement:** Consider the following algorithm to generate a sequence of numbers. Start with an integer n. If n is even, divide by 2. If n is odd, multiply by 3 and add 1. Repeat this process with the new value of n, terminating when n = 1. For example, the following sequence of numbers will be generated for n = 22:
268+
269+
22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1
270+
271+
**Problem statement:** It is conjectured (but not yet proven) that this algorithm will terminate at n = 1 for every integer n. Still, the conjecture holds for all integers up to at least 1, 000, 000. For an input n, the cycle-length of n is the number of numbers generated up to and including the 1. In the example above, the cycle length of 22 is 16. Given any two numbers i and j, you are to determine the maximum cycle length over all numbers between i and j, including both endpoints.

0 commit comments

Comments
 (0)