Python p.. Vivek (1)
Python p.. Vivek (1)
Acropolis Institute of
Technology and
Research, Indore Department of
CSE
Submitted To: Prof. Sumit Jain
(Artificial Intelligence &
Machine Learning)
Computer Workshop/Introduction to
Python-I (AL-306)
Submitted By: Vivek Devda
Enrollment No: 0827Al231149
[LAB ASSIGNMENT Computer Workshop/Introduction to Python-I (AL-306). The objective of this laboratory work is to give
students the exposure to Object Oriented Concepts using Python and implementations. ]
Department of CSE (Artificial Intelligence & Machine Learning)
CERTIFICATE
This is to certify that the experimental work entered in this journal as per
⮚ DO’S
✔ While entering into the LAB students should wear their ID cards.
✔ Students should sign in the LOGIN REGISTER before entering into the
laboratory.
✔ Students should come with observation and record note book to the laboratory.
⮚ DONT’S
Module2: Data Structure: List, Tuples, Dictionary, DataFrame and Sets, constructing,
indexing, slicing and content manipulation.
Module5: Modules and Packages: Standard Libraries: File I/0, Sys, logging, Regular
expression, Date and Time, Network programming, multi-processing and multi
threading.
References
RATIONALE:
The purpose of this subject is to study the fundamental strengths and limits of cloud
services as well as how these interact with our system, computer science, and other
disciplines.
⮚ Course Objectives
The objective of this course is to enable students in developing understanding of the
principles of Object-Oriented Programming (OOP): classes, objects, inheritance,
polymorphism, encapsulation, and abstraction. Also, students must be able to develop
Python programs using OOP techniques to solve real-world problems.
⮚ Course Outcomes
CO1: Demonstrate a clear understanding of basic Python programming concepts, including
data types, variables, operators, loops, and control structures.
CO2: Apply these concepts to write simple Python programs for solving basic
computational problems.
CO3: Develop the ability to work with Python's built-in data structures such as lists, tuples,
sets, and dictionaries.
CO4: Utilize appropriate data structures to solve problems related to data manipulation
and storage efficiently.
CO5: Apply file handling techniques using File I/0, Sys, logging in Python programs.
Index
Grade &
Date of Date of
S.No Name of the Experiment Sign of the
Exp. Submission Faculty
11 Write a Python program for Constructor and use the int method.
# Example Input/Output:
# Enter an integer: 42
# Decimal: 42, Hex: 0x2a, Octal: 0o52, Binary: 0b101010
# Enter your name: John Doe
# Uppercase: JOHN DOE, Lowercase: john doe, Title Case: John Doe
# Right-aligned (20 chars): John Doe, Centered (20 chars): John Doe
Q 3.Write various Python programs demonstrating use of If, If-else, Nested If-else.
If, If-else, Nested If-else
age = int(input("Enter your age: "))
if age < 13:
print("Child")
elif 13 <= age < 18:
print("Teenager")
else:
print("Adult")
Q11. Write a Python program for Constructor and use the init method.
Constructor ( init )
class Car:
def init (self, make, model):
self.make = make
self.model = model
def display(self):
print(f"Car: {self.make} {self.model}")
def make_sound(self):
print("Generic animal sound")
def give_birth(self):
print(f"{self.name} gives birth to live young.")
def wag_tail(self):
print(f"{self.name} wags its tail.")
# Demonstrate Inheritance
my_dog = Dog("Buddy", "Golden", "Golden Retriever")
my_dog.make_sound() # Output: Woof! (Overriding)
my_dog.make_sound("Loud") # Output: Woof! at Loud volume. (Simulated Overloading)
my_dog.wag_tail() # Output: Buddy wags its tail.
my_dog.give_birth() #Output: Buddy gives birth to live young. (Inherited from Mammal)