Professional Documents
Culture Documents
PY ALL - Merged
PY ALL - Merged
Lab Code :
Output :
Output:-
Output:-
Lab Code :
Output :
1. Write a Python program to accept number from user and calculate the sum of all
number between 1 and given number.
Lab Code/Theory :
Problem Definition: Write Python programs
Post lab :
print("str1")
Title: Write Python programs to sort a List of Tuples by the Last Element in Each
Tuple, to remove the Duplicates from a List and to Read a List of Words and Return
the Length of the Longest One.
Lab Code :
3. To Read a List of Words and Return the Length of the Longest One.
2. Write a program that inverts a dictionary. That is, it makes key of one dictionary as a
value of another and vice versa.
CO Mapping ECL404.3
.
Objective of the Experiment: Understanding the concept of Classes and Objects in Python.
Theory:
1. Write a Python class which has two methods get_String and print_String. get_String
accept a string from the user and print_String print the string in upper case
FR. CONCEICAO RODRIGUES COLLEGE OF ENGINEERING
Department of Electronics and Computer Science
CO Mapping ECL404.3
.
Objective of the Experiment: Understanding the concept of Inheritance and method over
riding in Python.
Theory:
It refers to defining a new class with little or no modification to an existing class. The new
class is called derived (or child) class and the one from which it inherits is called the base
(or parent) class.
Python Inheritance Syntax:
class BaseClass:
class DerivedClass(BaseClass):
Body of DerivedClass
Derived class inherits features from the base class where new features can be added to it. This
results in re-usability of code.
Lab Code:
a. To count number of lines, words and characters in the file
Output:
Output:
Output:
Output:
Output:
Lab Code :
Output:
Output:
Output:
Output:
5. Get the sum of second and third elements of the above array
Output:
Output:
Output:
Output:
A.
Output:
Output:
Output:
1. There is an array :[[0,0,0],[1,2,3],[4,5,6]]. Add the elements of the first column by 10, second
column by 20 and third column by 30. Use NumPy broadcasting
Output:
Lab Code:
1. Display a simple line plot of angle in radians vs. its sine value in Matplotlib
Output:
Output:
Output:
Output: