0% found this document useful (0 votes)
37 views3 pages

Python Programming Exercises and Concepts

Uploaded by

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

Python Programming Exercises and Concepts

Uploaded by

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

1. a) Write a program to find the largest element among three numbers.

b) Write a program to display all prime numbers within an interval.


c) Write a program to swap two numbers without using a temporary variable.

2. Demonstrate Python Operators with suitable examples (Arithmetic, Relational,


Assignment, Logical, Bitwise, Ternary, Membership, Identity).

3. a) Write a program to add and multiply complex numbers.


b) Write a program to print multiplication table of a given number.
c) Function with multiple return values.

4. a) Function using default arguments.


b) Find length of string with out using any library functions.
c) Check if a substring is present in a given string.

5. a) Perform Addition, Insertion & Slicing operations on a list.


b) Perform5differentbuilt-infunctionsona list.
c) Tuple operations, concatenate and display.

6. a) Count number of vowels in a string(No control flow allowed).


b) Check if a given key exists in a dictionary.
c) Add a new key-value pair to dictionary.
7. a) Sum of all items in a dictionary.
b) Sort words from a file →write in to another file in lowercase.
c) Print each line of a file in reverse order.

8. a) Count characters ,words & lines in a file.


b) Array operations: Create, Display, Append, Insert, Reverse.
c) Matrix operations: Add, Transpose and Multiply.

9. Create Shape class → Implement area & perimeter in subclasses (Circle, Triangle,
Square).

10. a) Check whether JSON string contains a complex object or not.


b) Demonstrate NumPy array creation using array().
c) Demonstrate ndim, shape, size, dtype attributes.

11. a) Demonstrate slicing, integer & Boolean indexing in NumPy.


b) Find min, max, sum, cumulative sum of an array.
c) Create a Data Frame from dictionary (5 keys × 10values),explore using head() and
selection.

12. a) Scatter & plot analysis between any two selected Data Frame columns using
Matplotlib.
b) Write a program to find the largest element among three numbers.
c) Write a program to display all prime numbers within an interval.

You might also like