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

Programming in Python Functions

Uploaded by

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

Programming in Python Functions

Uploaded by

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

Programming in Python

(Assignment on Python function for class XII student) –

1. Write a function in Python to swap() first half of the elements with the
second half of the elements. Also implement this function in a Python
Program

Example:

List = [1,2,3,4,5,6,7,8,9,10]

Result = [ 6,7,8,9,10,1,2,3,4,5]

2. Write a Python Program to read a text file. Find out the total number of
words available in this file.

3. Write a program in Python to read a text file line by line and print it on the
screen.

4. Write a program in python to read a text file and remove all the lines that
contain the character `a’ in a file and write it to another file.

5. Write a random number generator that generates random numbers


between 1 and 6 (simulates a dice).

6. Write a recursive Python program to test if a string is a palindrome or not.

*************************************************************

You might also like