Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
58 views

Programming in Python

This document contains a list of 21 programming tasks in Python including: 1) Implementing a stack and queue using lists, 2) Writing functions to check primality, swap list elements, compute factorials and Fibonacci numbers recursively, and find the sum of list elements recursively, 3) Reading and processing text files, 4) Generating simple graphs and charts using Pyplot, 5) Plotting functions, creating a GUI calculator using Tkinter, opening a webpage with urllib, and computing loan EMIs with numpy/scipy.

Uploaded by

Dr. Itesh Gupta
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views

Programming in Python

This document contains a list of 21 programming tasks in Python including: 1) Implementing a stack and queue using lists, 2) Writing functions to check primality, swap list elements, compute factorials and Fibonacci numbers recursively, and find the sum of list elements recursively, 3) Reading and processing text files, 4) Generating simple graphs and charts using Pyplot, 5) Plotting functions, creating a GUI calculator using Tkinter, opening a webpage with urllib, and computing loan EMIs with numpy/scipy.

Uploaded by

Dr. Itesh Gupta
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Programming in Python [ Python 3.

6 min )
1. Write a Python program to implement a stack using a list data-
structure.
2. Write a python Program to implement Queue using a list data
structure
3. Write a function in Python to check the primarily of an integer
number. Also implement this function in a Python Program.
4. 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]

5. Write a recursive function in Python to find the factorial of a


natural number. Also implement this function in a Python
Program.
6. Write a recursive function in python to find out the sum of
digits of any integer number. Also implement this function in a
Python program.
7. Write a recursive function to compute the nth Fibonacci
number. Also implement this function in a Python Program.
8. Write a recursive function in Python to find the sum of all
elements of a list. Also implement this function in a Python
Program
9. Write a recursive Python program to test if a string is a
palindrome or not.
10. Write a Python Program to read a text file. Find out the
total number of words available in this file.
11. Write a program in Python to read a text file line by line
and print it on the screen.
12. 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.
13. Write a Python function sin(x, n) to calculate the value of
sin(x) using its Taylor series expansion up to n terms.
Compare the values of sin(x) for different values of n with the
correct value.
14. Write a random number generator that generates random
numbers between 1 and 6 (simulates a dice).
15. Write a python program to generate a simple bar graph
using Pyplot. The graph should be properly labeled.
16. Write a python program to generate Pie-chart using
Pyplot. The graph should be properly labeled.
17. Write a Python program to plot the function y = x2 using
the pyplot or matplotlib libraries.
18. Create a graphical application that accepts user inputs,
performs some operation on them, and then writes the output
on the screen. For example, write a small calculator. Use the
tkinter library.
19. Open a webpage using the urllib library.
20. Compute EMIs for a loan using the numpy or scipy
libraries.
21. Take a sample of 10 phishing e-mails and find the most
common words.

You might also like