0% found this document useful (0 votes)
65 views1 page

Python Practice Programs

The document contains 6 Python practice programs: 1) Find numbers between 2000-3200 divisible by 7 but not 5. 2) Generate a dictionary of squares of integers from 1 to n. 3) Convert comma separated numbers to a list and tuple. 4) Sort and output comma separated words alphabetically. 5) Capitalize all characters in input lines. 6) Remove duplicate words and sort alphanumerically.

Uploaded by

Lalit Kaul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views1 page

Python Practice Programs

The document contains 6 Python practice programs: 1) Find numbers between 2000-3200 divisible by 7 but not 5. 2) Generate a dictionary of squares of integers from 1 to n. 3) Convert comma separated numbers to a list and tuple. 4) Sort and output comma separated words alphabetically. 5) Capitalize all characters in input lines. 6) Remove duplicate words and sort alphanumerically.

Uploaded by

Lalit Kaul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Python practice programs:

1)Write a program which will find all such numbers which are divisible by 7 but are
not a multiple of 5,
between 2000 and 3200 (both included).

2) With a given integral number n, write a program to generate a dictionary that


contains (i, i*i) such that is an integral number between 1 and n (both included).
and then the program should print the dictionary.
Suppose the following input is supplied to the program:
8
Then, the output should be:
{1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64}

3) Write a program which accepts a sequence of comma-separated numbers from console


and generate a list and a tuple which contains every number.
Suppose the following input is supplied to the program:
34,67,55,33,12,98
Then, the output should be:
['34', '67', '55', '33', '12', '98']
('34', '67', '55', '33', '12', '98')

4) 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.
Suppose the following input is supplied to the program:
without,hello,bag,world
Then, the output should beforbag,hello,without,world

5) Write a program that accepts sequence of lines as input and prints the lines
after making all characters in the sentence capitalized.
Suppose the following input is supplied to the program:
Hello world
Practice makes perfect
Then, the output should be:
HELLO WORLD
PRACTICE MAKES PERFECT

6) Write a program that accepts a sequence of whitespace separated words as input


and prints the words after removing all duplicate words and sorting them
alphanumerically.
Suppose the following input is supplied to the program:
hello world and practice makes perfect and hello world ag

You might also like