0% found this document useful (0 votes)
56 views2 pages

Python Programming Experiments List

The document outlines a list of experiments for a Python programming course, divided into 10 sections. It includes programs using data types, operators, conditional and control statements, functions, strings, lists, dictionaries, files, database connectivity, and data visualization. Some example programs are converting Celsius to Fahrenheit, calculating area of a circle, sorting words alphabetically, merging and sorting lists, searching dictionaries, and plotting graphs. The course is offered at Saveetha Institute of Medical and Technical Sciences, Saveetha School of Engineering, Saveetha University, Chennai.

Uploaded by

Gnana Sekhar
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)
56 views2 pages

Python Programming Experiments List

The document outlines a list of experiments for a Python programming course, divided into 10 sections. It includes programs using data types, operators, conditional and control statements, functions, strings, lists, dictionaries, files, database connectivity, and data visualization. Some example programs are converting Celsius to Fahrenheit, calculating area of a circle, sorting words alphabetically, merging and sorting lists, searching dictionaries, and plotting graphs. The course is offered at Saveetha Institute of Medical and Technical Sciences, Saveetha School of Engineering, Saveetha University, Chennai.

Uploaded by

Gnana Sekhar
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

SAVEETHA INSTITUTE OF MEDICAL AND TECHNICAL SCIENCES

SAVEETHA SCHOOL OF ENGINEERING


SAVEETHA UNIVERSITY, CHENNAI-602105

CS018–Python Programming

List of Experiments

1. Programs using Data types, Operators and Expression


(a) Write a program to convert Celsius to Fahrenheit
(b) Write a program to calculate area of a Circle
(c) Write a program to calculate Simple Interest for the given principal amount
2. Programs using Conditional Statements.
(a) Write a program to find grade and average marks of a student
(b) Write a program to find Greatest of three numbers.
(c) Write a program to solve Quadratic Equation.
3. Programs using Control Statements.
(a) Write a program to find sum of N numbers
(b) Write a program to find factorial of given number
(c) Write a program to implement a multiplication table.
(d) Write a program to find Fibonacci series of a given number
4. Programs using Functions.
(a) Write a program to implement a simple calculator
(b) Write a program to find odd or even number
(c) Write a program to find factorial of given number using recursion
(d) Write a program to find Fibonacci series of a given number using recursion
5. Programs using Strings.
(a) Write a program to check whether a given string is Palindrome
(b) Write a program to check whether a given string is Anagram.
(c) Write a program to count number of words and characters in a given string.
(d) Write a program to sort words in alphabetical order.
(e) Write a program to count number of vowels in a given string.
6. Programs using List
(a) Write a program to find a maximum element in a list without using built in
function
(b) Write a program to merge two lists and sort it.
(c) Write a program to sort a list according to the length of the elements.
(d) Write a program to perform linear search in a given list.
(e) Write a program to print prime numbers in a given list.
7. Programs using Dictionaries
(a) Write a program to concatenate two dictionaries.
(b) Write a program to search a key element from a dictionary
(c) Write a program to print product of all elements.
(d) Write a program to delete a key from dictionary.
(e) Write a program to count frequency of words using dictionary.
SAVEETHA INSTITUTE OF MEDICAL AND TECHNICAL SCIENCES
SAVEETHA SCHOOL OF ENGINEERING
SAVEETHA UNIVERSITY, CHENNAI-602105

8. Programs using Files


(a) Write a program to find occurrences of a given word in a text file.
(b) Write a program to find occurrences of a given letter in a text file.
(c) Write a program to count number of words in a text file.
(d) Write a program to count number of letters in a text file.
(e) Write a program to count number of lines in a text file.

9. Write a program to create database connectivity with MYSQL and create a table for
maintaining employee database with employee’s details.

10. Write a program to plot the following: -


a) Bar Graph
b) Scatter Plot
c) Pie Chart
d) Histogram

Course Faculty Course Coordinator Course Head HOD

Common questions

Powered by AI

Iteratively computing the Fibonacci series involves using a loop to update two variables representing sequential Fibonacci numbers, which is memory efficient with an O(n) time complexity. Recursively using a Python function involves calling itself with the two previous numbers, with a base case to stop recursion, and typically has higher memory consumption and an O(2^n) time complexity due to repeated calculations. The trade-off is between recursion's simplicity and elegance vs. iteration's efficiency.

Plotting data using different types of graphs offers unique insights. Bar graphs compare categorical data with easily interpretable height indicators. Scatter plots identify relationships or correlations between datasets, highlighting patterns or outliers. Pie charts show part-to-whole relationships in proportions, useful for visualizing distribution. Histograms display data distribution over continuous intervals, revealing frequency and variation patterns. These tools prioritize suitability to data type and analysis goal.

Managing database connectivity in Python enhances data handling by enabling structured data storage and retrieval operations. For creating an employee database table in MySQL, use a library like mysql-connector-python for establishing a connection. Considerations include defining clear schema fields (e.g., ID, name, position), error handling for connection issues, and ensuring SQL injection protection. This approach facilitates complex queries and data manipulation tasks.

To search for a key in a dictionary in Python, use the `in` keyword to check its existence, which operates in average O(1) time complexity due to Python's hash table implementation of dictionaries. Considerations for efficiency include handling non-existent keys gracefully using try-except blocks to catch KeyError or using the `get()` method to return a default value. This ensures robust program behavior in diverse data scenarios.

In Python, to find the greatest of three numbers, you can use nested conditional statements. First, compare the first two numbers to find the larger, then compare the result with the third number. Alternatively, using if-elif-else statements can streamline this comparison flow. Conditional statements help partition the problem into smaller decisions, optimizing the solution.

To determine the number of vowels in a given string using Python, loop through each character in the string and check if it is a vowel (a, e, i, o, u, both uppercase and lowercase). Count each vowel occurrence using a counter variable. Relevant string methods include lower() or upper() for uniformity and isalpha() to ignore non-alphabetic characters. The result is the sum of all vowel occurrences.

Concatenating two dictionaries involves merging their key-value pairs. In Python, this can be done using the update() method or using dictionary unpacking in Python 3.5+. This operation is important for data manipulation as it allows integrating and expanding datasets, ensuring comprehensive data representation without data loss or redundancy. Care should be taken to handle key collisions, where values may need consolidation.

Error handling in file operations is critical to manage cases such as non-existent files or file access issues (e.g., permissions). In Python, use try-except blocks where the file open operation occurs. In the except block, handle specific exceptions like FileNotFoundError by notifying the user or logging the error. This ensures robustness and user-friendly error management in applications that count words in a text file.

To merge two lists and sort them without using built-in sorting functions, first concatenate the lists using the `+` operator or the `extend()` method. Then, implement a sorting algorithm such as bubble sort or insertion sort to order the merged list. This process emphasizes understanding algorithm mechanics over leveraging library functions.

To implement a simple calculator in Python using functions, you should create individual functions for each arithmetic operation: addition, subtraction, multiplication, and division. Each function should take two numbers as arguments and return the result of the operation. The calculator should also include error handling for division by zero and ensure that inputs are valid numbers. User interaction can be managed through a simple text-based menu that calls these functions based on user input.

You might also like