[Go to site: main page, start]

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

Python Programming Lab Syllabus for B.Tech

Uploaded by

rajesh6j5
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)
23 views3 pages

Python Programming Lab Syllabus for B.Tech

Uploaded by

rajesh6j5
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

R25 [Link].

CSE, IT, CSE (AI&ML) & CSE (Data Science) Syllabus GNITS
Hyderabad

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


AUTONOMOUS
(FOR WOMEN)

PYTHON PROGRAMMING LAB


[Link]. I Year II Sem. L T PC
0 0 2 1
Course Objectives:
 To install and run the Python interpreter
 To learn control structures.
 To Understand Lists, Dictionaries in python
 To Handle Strings and Files in Python

Course Outcomes: After completion of the course, the student should be able to
 Develop the application specific codes using python.
 Understand Strings, Lists, Tuples and Dictionaries in Python
 Verify programs using modular approach, file I/O, Python standard library
 Implement Digital Systems using Python
 Design GUI based applications using Python.

Note: The lab experiments will be like the following experiment examples.
List of Experiments:
1.
I. Use a web browser to go to the Python website [Link] This page
contains information about Python and links to Python-related pages, and it
gives you the ability to search the Python documentation.
II. Start the Python interpreter and type help() to start the online help utility.
2. Start a Python interpreter and use it as a Calculator.
3. Write a program to calculate compound interest when principal, rate and number of
periods are given.
4. Read the name, address, email and phone number of a person through the keyboard
and print the details.
5. Print the below triangle using for
loop. 5
44
333
2222
11111
6. Write a program to check whether the given input is digit or lowercase character or
uppercase character or a special character(use 'if-else-if' ladder)
7. Python program to print all prime numbers in a given interval (use break)
8. Write a program to convert a list and tuple into arrays.
9. Write a program to find common values between two arrays.
10. Write a function called palindrome that takes a string argument and returnsTrue if it
is a palindrome and False otherwise. Remember that you can use the built-in function
R25 [Link]. CSE, IT, CSE (AI&ML) & CSE (Data Science) Syllabus GNITS
Hyderabad

len to check the length of a string.


11. Write a function called is_sorted that takes a list as a parameter and returns True if
the list is sorted in ascending order and False otherwise.
12. Write a function called has_duplicates that takes a list and returns True if there is any
element that appears more than once. It should not modify the original list.
13. Write a function called remove_duplicates that takes a list and returns a new list with
only the unique elements from the original. Hint: they don’t have to be in the same
order.
14. The wordlist I provided, [Link], doesn’t contain single letter words. So you might
want to add “I”, “a”, and the empty string.
15. Write a python code to read dictionary values from the user. Construct a function to
invert its content. i.e., keys should be values and values should be keys.
16. Add a comma between the characters. If the given word is 'Apple', it should become
'A,p,p,l,e'
17. Remove the given word in all the places in a string?
18. Write a function that takes a sentence as an input parameter and replaces the first
letter of every word with the corresponding upper case letter and the rest of the letters
in the word by corresponding letters in lower case without using a built-in function?
19. Writes a recursive function that generates all binary strings of n-bit length
20. Write a python program that defines a matrix and prints
21. Write a python program to perform multiplication of two square matrices
22. How do you make a module? Give an example of construction of a module using
different geometrical shapes and operations on them as its functions.
23. Use the structure of exception handling all general-purpose exceptions.
24. Write a function called draw_rectangle that takes a Canvas and a Rectangle as
arguments and draws a representation of the Rectangle on the Canvas.
25. Add an attribute named color to your Rectangle objects and modify draw_rectangle
so that it uses the color attribute as the fill color.
26. Write a function called draw_point that takes a Canvas and a Point as arguments and
draws a representation of the Point on the Canvas.
27. Define a new class called Circle with appropriate attributes and instantiate a few
Circle objects. Write a function called draw_circle that draws circles on the canvas.
28. Write a python code to read a phone number and email-id from the user and
validate it for correctness.
29. Write a Python code to merge two given file contents into a third file.
30. Write a Python code to open a given file and construct a function to check for
given words present in it and display on found.
31. Write a Python code to Read text from a text file, find the word with most number of
occurrences
32. Write a function that reads a file file1and displays the number of words, number of
vowels, blank spaces, lower case letters and uppercase letters.
33. Import numpy, Plotpy and Scipy and explore their functionalities.
34. Install NumPypackage with pip and explore it.
35. Write a program to implement Digital Logic Gates – AND, OR, NOT, EX-OR
R25 [Link]. CSE, IT, CSE (AI&ML) & CSE (Data Science) Syllabus GNITS
Hyderabad

36. Write a GUI program to create a window wizard having two text labels, two text
fields and two buttons as Submit and Reset.

TEXT BOOKS:
1. Supercharged Python: Take your code to the next level, Overland
2. Learning Python, Mark Lutz, O'reilly

REFERENCE BOOKS:
1. Python Programming: A Modern Approach, Vamsi Kurama, Pearson
2. Python Programming A Modular Approach with Graphics, Database, Mobile,
and Web Applications, Sheetal Taneja, Naveen Kumar, Pearson
3. Introduction to Python Programming, Gowrishakar S, Veena A, CRC Press
4. Programming with Python, A User’s Book, Michael Dawson, Cengage Learning,
India Edition
5. Python for Data Science, Dr. Mohd Abdul Hameed, Wiley publications
6. Core Python Programming, Dr. R. Nageswara Rao, Dreamtech press
7. Introduction to Python, Gowrishankar S, Veena A., CRC Press

Common questions

Powered by AI

Python handles file input/output operations using built-in functions such as open(), read(), and write(). For efficient file management, it's best practice to use the 'with' statement, which ensures proper acquisition and release of file resources, preventing memory leaks. It automatically closes the file when the block of code is exited, even if exceptions are raised. Developers should also handle potential I/O errors using exception handling to promote safe file operations .

Designing a Python-based application for digital logic gate simulation involves defining classes or functions to represent different logic gates (AND, OR, NOT, XOR, etc.) and implementing their logic using boolean algebra. Key components include a user interface for inputting boolean expressions or gate conditions, logic for processing these expressions, and an output system to display results. Challenges may include handling complex logical expressions and ensuring accurate simulation of gate behavior, especially in cases where gate combinations become intricate .

Developing a Python application using dictionary inversion involves several steps. First, the developer must read dictionary values from the user, which involves prompting for input and processing that input into key-value pairs. The function to invert the dictionary then needs to swap keys and values. A potential challenge in this process is ensuring all values are unique; otherwise, inverting a dictionary with duplicate values will result in data loss .

Python is highly effective for data science applications due to its simplicity, versatility, and extensive library support. Essential libraries include NumPy for numerical computations and array manipulations, Pandas for data handling and manipulation, Matplotlib and Seaborn for data visualization, and SciPy for scientific computations. These libraries allow for efficient data processing, analysis, and visualization, enabling data scientists to extract insights and make data-driven decisions effectively .

GUI elements enhance the usability of applications by providing intuitive and user-friendly ways for users to interact with the program, reducing the reliance on command-line inputs and outputs. To create a basic GUI program in Python, one needs to use a library such as Tkinter. Foundational steps include importing the library, creating a main application window, adding GUI components such as labels, text fields, and buttons, and writing callback functions to handle interactions .

Modular programming involves breaking down a large application into manageable, independent modules, each with a specific functionality. This approach facilitates easier testing and debugging, as each module can be individually validated against its requirements. In the context of verifying complex programs, modularity allows developers to focus on isolated components, testing them thoroughly before integration. This simplifies the troubleshooting process and enhances code reliability and maintainability. It ensures that changes or updates to one module do not inadvertently affect others, leading to reduced development and debugging time .

Incorporating hands-on Python programming exercises in a university syllabus provides numerous educational benefits for Computer Science students. It enhances practical coding skills, reinforces theoretical concepts, and promotes problem-solving abilities. These exercises bridge the gap between classroom learning and real-world applications, encouraging collaborative learning and creativity. Such experiential learning approaches increase retention and understanding, preparing students for industry demands with practical experience and a comprehensive understanding of Python programming .

Effective strategies for teaching recursion include using visual aids to explain recursive function calls and their execution stacks, demonstrating simple recursive algorithms like calculating factorials or computing Fibonacci sequences, and gradually increasing complexity as students become comfortable. Practical programming exercises, such as generating n-bit binary strings recursively, provide hands-on experience that solidifies understanding. Encouraging students to trace through recursive calls on paper can help demystify the process, making the concept more accessible .

Exception handling is crucial in Python programming as it improves the robustness and fault tolerance of an application by catching and managing errors gracefully. A general-purpose exception handling structure can be implemented using try and except blocks, where multiple exceptions can be handled in sequence to address different error types. For instance, a divide-by-zero error and file-not-found error can be caught in successive except blocks, allowing the program to take remedial actions such as providing user feedback or attempting alternative solutions .

In Python, lists are mutable, dynamic arrays that allow elements to be added, removed, or changed. Tuples, on the other hand, are immutable, meaning once they are created, their elements cannot be altered. Lists are preferable when the data set is expected to change frequently during an application's runtime. Tuples are preferred for scenarios where the data should remain constant throughout the program execution, providing a level of data protection and an easy-to-understand fixed structure. Furthermore, the immutability of tuples gives them performance advantages in terms of faster processing and reduced memory usage under certain conditions .

You might also like