Skip to content

Latest commit

 

History

History
26 lines (26 loc) · 2.28 KB

File metadata and controls

26 lines (26 loc) · 2.28 KB

Python Programs from Task 1

1. Take an arithmetic expression as input and solve it.

eg. python arithSolver.py 6+5*4/5

Check out the short program here

2. Take a bunch of strings as input and output them in alphabetical order.

eg. python strSorter.py igit igdtuw india

Check out the short program here

3. Take three numbers as input and find largest among them.

eg. python findLarge.py 45 87 12  

Check out the short program here

4. Take two strings as input and find whether second string is present in first string.

eg. python findPattern.py igdtuw gd

Check out the short program here

5. Use iterative method to find factorial of a given input number.

Check out the short program here

6. Use recursive method to find factorial of a given number.

Check out the short program here

7. Write program to illustrate user defined module and its usage.

refer to the solutions of question 8 and 9. The script q8.py has been imported in q9.py.

8. Read an input file containing names, roll numbers and marks of 10 students. Each student’s details are present in single line separated by comma. After reading the contents from file, store in a list of dictionary objects variable.

Check out the short program here

Input file : test.csv

9. Read the variable created above, randomly change marks of students and store them in a file such that each student’s details is in one single line.

Check out the short program here

10. Write a program that creates a divide by zero exception.

Check out the short program here