Vous êtes sur la page 1sur 2

1.

Between 400 to 1000 find the number divisible by 3 but not multiple of 5, output
should be single line seperated by comma
2. Get number in runtime as input and create dictionary (i,sqaure i)
EX:
4
{1: 1, 2:4, 3:18, 4:256}

3. Suppose the following input is given to your program:


with,hai,ball,word
Then, the output should be:
ball,hai,with,word

Input should be get in run-time and as single input


output shoud be sorted with given input

4. Suppose the following input is given to your program:


welcome to python!!! 123
Then, the output should be:
LETTERS 15
DIGITS 3
Input should be get in run-time and as single input

5. Write a password generator in Python. Be creative with how you generate


passwords - strong passwords have a mix of lowercase letters, uppercase letters,
numbers, and symbols. The passwords should be random, generating a new password
every time the user asks for a new password.
Password length should be get from user.

6. In cryptography, a Caesar cipher is a very simple encryption techniques in which


each letter in the plain text is replaced by a letter some fixed number of
positions down the alphabet.
For example, with a shift of 3, A would be replaced by D, B would become E, and so
on.
ROT-13 ("rotate by 13 places") is a widely used example of a Caesar cipher where
the shift is 13.
In Python, the key for ROT-13 may be represented by means of the following
dictionary:

key = {'a':'n', 'b':'o', 'c':'p', 'd':'q', 'e':'r', 'f':'s', 'g':'t', 'h':'u',


'i':'v', 'j':'w', 'k':'x', 'l':'y', 'm':'z', 'n':'a', 'o':'b', 'p':'c',
'q':'d', 'r':'e', 's':'f', 't':'g', 'u':'h', 'v':'i', 'w':'j', 'x':'k',
'y':'l', 'z':'m', 'A':'N', 'B':'O', 'C':'P', 'D':'Q', 'E':'R', 'F':'S',
'G':'T', 'H':'U', 'I':'V', 'J':'W', 'K':'X', 'L':'Y', 'M':'Z', 'N':'A',
'O':'B', 'P':'C', 'Q':'D', 'R':'E', 'S':'F', 'T':'G', 'U':'H', 'V':'I',
'W':'J', 'X':'K', 'Y':'L', 'Z':'M'}

Your task in this exercise is to implement an encoder/decoder of ROT-13. Once


you're done, you will be able to read the following secret message:

Pnrfne pvcure? V zhpu cersre Pnrfne fnynq!

7. Take two lists, say for example these two:

a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]


b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]

and write a program that returns a list that contains only the elements that are
common between the lists (without duplicates).
Make sure your program works on two lists of different sizes.

8. Generate a random number between 1 and 9 (including 1 and 9).


Ask the user to guess the number, then tell them whether they guessed too low, too
high, or exactly right.

9. Ask the user for a number and determine whether the number is prime or not

10. Write a program that takes a list of numbers (for example, a = [5, 10, 15, 20,
25]) and makes a new list of only the first and last elements of the given list.

11. Write a program with function that takes a list and returns a new list that
contains all the elements of the first list minus all the duplicates.

12. Write a program with function that asks the user for a long string containing
multiple words.
Print back to the user the same string, except with the words in backwards order
Eg:

i/p:
I am Surendar
o/p:
Surendar am I

Vous aimerez peut-être aussi