You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+57-7Lines changed: 57 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
** Question: 1**
1
+
###Question: 1
2
2
3
3
Write a program that accepts a comma separated sequence of words as input and prints the words in a comma-separated sequence after sorting them alphabetically.
4
4
Suppose the following input is supplied to the program:
@@ -12,7 +12,7 @@ Use a sorting method
12
12
13
13
14
14
15
-
** Question: 2**
15
+
###Question: 2
16
16
17
17
Write a program that accepts sequence of lines as input and prints the lines after making all characters in the sentence capitalized.
18
18
Suppose the following input is supplied to the program:
@@ -28,7 +28,7 @@ Use list and append
28
28
29
29
30
30
31
-
** Question: 3**
31
+
###Question: 3
32
32
33
33
Write a program which accepts a sequence of comma separated 4 digit binary numbers as its input and then check whether they are divisible by 5 or not. The numbers that are divisible by 5 are to be printed in a comma separated sequence.
34
34
Example:
@@ -42,7 +42,7 @@ In case of input data being supplied to the question, it should be assumed to be
42
42
Use list and .join
43
43
44
44
45
-
** Question: 4**
45
+
###Question: 4
46
46
47
47
Write a password generator in Python.
48
48
Be creative with how you generate passwords - strong passwords have a mix of lowercase letters, uppercase letters, numbers, and symbols.
@@ -53,7 +53,10 @@ Hint:
53
53
use Python’s random module,
54
54
55
55
```
56
-
This is your first exposure to using Python code that somebody else wrote. In Python, these formally-distributed code packages are called modules. The thing we want from a module in this exercise is the ability to generate random numbers. This comes from the random module.
56
+
This is your first exposure to using Python code that somebody else wrote.
57
+
In Python, these formally-distributed code packages are called modules.
58
+
The thing we want from a module in this exercise is the ability to generate random numbers.
59
+
This comes from the random module.
57
60
58
61
To use a module, at the top of your file, type
59
62
```
@@ -62,7 +65,8 @@ To use a module, at the top of your file, type
62
65
import random
63
66
```
64
67
```
65
-
This means you are allowing your Python program to use a module called random in the rest of your code.
68
+
This means you are allowing your Python program to use a module called random in
69
+
the rest of your code.
66
70
67
71
To use it (and generate a random integer), now type:
68
72
```
@@ -76,4 +80,50 @@ Once you run this program, the variable a will have a random integer that the co
76
80
Bonus:
77
81
Ask the user how strong they want their password to be. For weak passwords, pick a word or two from a list.
78
82
79
-
Happy coding!
83
+
Happy coding!
84
+
85
+
86
+
### Question 5
87
+
88
+
This is a feature phone keypad:
89
+
90
+
------- ------- -------
91
+
||| ABC || DEF |
92
+
| 1 || 2 || 3 |
93
+
------- ------- -------
94
+
------- ------- -------
95
+
| GHI || JKL || MNO |
96
+
| 4 || 5 || 6 |
97
+
------- ------- -------
98
+
------- ------- -------
99
+
|PQRS || TUV || WXYZ|
100
+
| 7 || 8 || 9 |
101
+
------- ------- -------
102
+
------- ------- -------
103
+
||||||
104
+
| * || 0 || # |
105
+
------- ------- -------
106
+
107
+
108
+
Before predictive text entry systems like T9, you had to press a button
109
+
repeatedly to cycle through the possible values until you reached
110
+
the one you wanted.
111
+
112
+
For example, to type "V8" you would press the 8 key three times and then
113
+
again four times (pressing the 8 key cycles through T->U->V->8),
114
+
giving us a total of seven key presses.
115
+
116
+
Note: the 0 key handles spaces and outputs 0 when tapped twice.
117
+
118
+
Write a function that can calculate the amount of button presses required for any phrase.
119
+
Except for spaces, punctuation can be ignored.
120
+
Your function should accept both uppercase and lowercase letters and treat them the same.
121
+
122
+
Examples:
123
+
presses('V8') # 7
124
+
presses('LOL') # 9
125
+
presses('How R u 2day') # 23
126
+
127
+
Bonus: Try to avoid hard-coding the number of button presses for each letter!
128
+
Resource:
129
+
Use python [Dictionaries](http://www.learnpython.org/en/Dictionaries) in this exercise
0 commit comments