Assignment (2)
Assignment (2)
Python
Project
1:
Page 1: Problem Statement
Problem Statement:
Design a conceptual mind map and detailed overview of Robots and Robotic Systems. The
mind map should cover the following aspects: Features, Applications, and Classification of
Robots. Each section must be explained in detail with proper input/output specifications
and variable descriptions in a programming context. The aim of this assignment is to
explore how robots function, their diverse applications, and the different classifications
used in robotic systems. Students are expected to represent this knowledge both
conceptually (mind map) and technically (code).
Page 2: Coding
Coding:
The following code demonstrates how to implement a simple Python-based program that
simulates a mind map representation for Robots and Robotic Systems. The program
organizes the robot features, applications, and classifications into a nested dictionary and
allows users to explore each category interactively.
def display_mind_map(category):
print(f"--- {category} ---")
if isinstance(robots_data[category], list):
for item in robots_data[category]:
print(item)
elif isinstance(robots_data[category], dict):
for sub_cat, sub_items in robots_data[category].items():
print(f"\n{sub_cat}:")
for sub_item in sub_items:
print(f"- {sub_item}")
# User Interface
while True:
print("\nSelect a category to explore:")
print("1. Features\n2. Applications\n3. Classification\n4. Exit")
choice = int(input("Enter your choice: "))
if choice == 1:
display_mind_map("Features")
elif choice == 2:
display_mind_map("Applications")
elif choice == 3:
display_mind_map("Classification")
elif choice == 4:
print("Exiting...")
break
else:
print("Invalid choice, please select again.")
Page 3: Input / Output
Input/Output:
Input:
The program expects the user to select a category (Features, Applications, or Classification)
by entering a number from 1 to 4.
Example input:
Enter your choice: 1
Output:
The program displays the selected category and its subcategories.
Example output:
--- Features ---
Sensors
Actuators
Power Source
AI
Autonomy
Mobility
End Effectors
Page 4: Variable Description Table
The following table provides a description of the variables used in the Python code,
including their types and roles in the program.
The dictionary `robots_data` contains information about the robot features, applications,
and classifications. This data is accessed and displayed through the function
`display_mind_map()` based on the user’s selection. The `choice` variable stores the input
given by the user, which determines which category to display.
Page 5: Conclusion
Conclusion:
This assignment offers a comprehensive overview of the essential aspects of robots and
robotic systems, including their features, applications, and classifications. It also
demonstrates how such information can be managed and accessed through a basic Python
program. The coding exercise reinforces data organization, user input handling, and
structured output, providing a foundation for developing more advanced interactive
systems in robotics.
Project 2:
Project 5 :
Project 6 :
v
Project 7:
Project 8:
Project 9:
Project 10:
Classroom:
(i) Storing Student details.
(ii) Calculating percentages,
CGPA.
(iii) Generating report card:
Function to enter which student’s report card is being
made.
(iv) Function to fetch student
details from the saved data.
(v) Function to display the final
result.
(vi) If-else: Checking for
scholarship.
(vii) Iterating through student
details and fetching required details.
Code:
class Student:
def __init__(self, name, roll_number, marks):
self.name = name
self.roll_number = roll_number
self.marks = marks
self.percentage = self.calculate_percentage()
self.cgpa = self.calculate_cgpa()
def calculate_percentage(self):
return sum(self.marks) / len(self.marks)
def calculate_cgpa(self):
return self.percentage / 10 # Assuming CGPA is
percentage divided by 10
class Classroom:
def __init__(self):
self.students = {}
def store_student_details(self):
name = input("Enter student's name: ")
roll_number = input("Enter roll number: ")
# Input marks
marks = []
num_subjects = int(input("Enter number of
subjects: "))
for i in range(num_subjects):
mark = float(input(f"Enter marks for subject
{i + 1}: "))
marks.append(mark)
def generate_report_card(self):
roll_number = input("Enter roll number to
generate report card: ")
if roll_number in self.students:
student = self.students[roll_number]
print(f"\nReport Card for {student.name}
(Roll Number: {roll_number})")
print(f"Marks: {student.marks}")
print(f"Percentage: {student.percentage:.2f}
%")
print(f"CGPA: {student.cgpa:.2f}")
self.check_scholarship(student.percentage)
else:
print("Student not found.\n")
def fetch_student_details(self):
roll_number = input("Enter roll number to fetch
details: ")
if roll_number in self.students:
student = self.students[roll_number]
print(f"\nDetails for {student.name}:")
print(f"Roll Number: {student.roll_number}")
print(f"Marks: {student.marks}")
print(f"Percentage: {student.percentage:.2f}
%")
print(f"CGPA: {student.cgpa:.2f}\n")
else:
print("Student not found.\n")
def display_final_result(self):
print("\nFinal Results:")
for roll_number, student in self.students.items():
print(f"{student.name} (Roll No:
{roll_number}) - Final Percentage:
{student.percentage:.2f}%")
print()
def main():
classroom = Classroom()
while True:
print("1. Add Student Details")
print("2. Generate Report Card")
print("3. Fetch Student Details")
print("4. Display Final Results")
print("5. Exit")
if choice == '1':
classroom.store_student_details()
elif choice == '2':
classroom.generate_report_card()
elif choice == '3':
classroom.fetch_student_details()
elif choice == '4':
classroom.display_final_result()
elif choice == '5':
print("Exiting the program. Goodbye!")
break
else:
print("Invalid choice. Please try again.\n")