All Program of 6th Sem Python Programming Lab. These Program includes the explaination & basics of lists, tuples, data-types, functions, dictionary, loops, operators, sorting methods, strings & sets etc.
The Python Programming Lab at Rajasthan Technical University (RTU) is designed to introduce students to the fundamentals of Python, a versatile, high-level, interpreted programming language widely used in academia and industry. This lab provides hands-on experience to help students understand core programming concepts, develop problem-solving skills, and gain proficiency in writing, testing, and debugging Python programs.
- To familiarize students with Python’s syntax and semantics through practical exercises.
- To develop a strong foundation in programming constructs such as data types, operators, control flow (loops and conditionals), and functions.
- To explore Python’s built-in data structures including lists, tuples, sets, and dictionaries.
- To teach modular programming using functions and modules.
- To introduce file handling, regular expressions, and basic object-oriented programming concepts.
- To enable students to write efficient and readable Python code for solving real-world problems.
By the end of this lab course, students will be able to:
- Write, test, and debug Python programs using both interactive shell and script modes.
- Implement decision-making and looping constructs to control program flow.
- Use Python’s data structures effectively to store and manipulate data.
- Define and invoke functions and organize code into reusable modules.
- Perform file input/output operations and handle exceptions.
- Apply regular expressions for pattern matching and data validation.
- Understand and implement basic object-oriented programming concepts such as classes and objects.
- Python versions 2.7.x, 3.6.x, or later are used depending on the curriculum.
- Programming is typically done using IDLE (Python’s Integrated Development and Learning Environment), command-line interface, or other IDEs.
- The lab environment supports Windows, macOS, and Linux platforms.
This lab bridges theoretical programming concepts with practical implementation, enabling students to visualize and experiment with Python code. It prepares students for advanced programming courses and equips them with skills relevant to software development, data analysis, automation, and other computing fields.
1. Write a program to demonstratebasic data type in python.
2. (a.) Write a program to compute distance between two points taking input from the user.
(b.) Write a program add.py that takes 2 numbers as command line arguments and prints its sum.
3. (a.) Write a Program for checking whether the givennumber is an even number or not.
(b.) Using a for loop, write a program that prints out the decimal equivalents of 1/2, 1/3, 1/4, . . . , 1/10
4. (a.) Write a Program to demonstrate list and tuple in python.
(b.) Write a program using a forloop that loops over a sequence.
(c.) Write a program using a while loop that asks the user for a number, and prints a countdown from that number to zero.
5. Find the sum of all the primes below two million. By considering the terms in the Fibonacci sequence whose values do not exceed four million, WAP to find the sum of the even-valued terms.
6. (a.) Write a program to count the numbers of characters in the string and store them in a dictionary data structure.
(b.) Write a program to use split and join methods in the string and trace a birthday of a person with a dictionary data structure.
7. (a.) Write a program to count frequency of characters in a given file. Can you use character frequency to tell whether the given file is a Python program file, C program file or a text file?
(b.) Write a program to count frequency of characters in a given file. Can you use character frequency to tell whether the given file is a Python program file, C program file or a text file?
8. (a.)Write aprogram to print each line of a file in reverse order.
(b.) Write a program to compute the number of characters, words and lines in a file.
9. (a.) Write a function nearly equal to test whether two strings are nearly equal. Two strings a andb are nearly equal when a can be generated by a single mutation on.
(b.) Write function to compute gcd, lcm of two numbers. Each function shouldn’t exceed one line.
10. (a.) Write a program to implement Merge sort.
(b.) Write a program to implement Selection sort, Insertion sort.






