0% found this document useful (0 votes)
3 views

Assignment (2)

The document outlines an assignment focused on creating a mind map and detailed overview of Robots and Robotic Systems, including their features, applications, and classifications, alongside a Python program to simulate this information. It also discusses various types of errors in Python, the functionality of while loops, and a classroom management system for student details and report cards. Additionally, it explores the dual nature of AI as both a beneficial and harmful technology, emphasizing the importance of ethical considerations in its application.

Uploaded by

praneet.ry
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Assignment (2)

The document outlines an assignment focused on creating a mind map and detailed overview of Robots and Robotic Systems, including their features, applications, and classifications, alongside a Python program to simulate this information. It also discusses various types of errors in Python, the functionality of while loops, and a classroom management system for student details and report cards. Additionally, it explores the dual nature of AI as both a beneficial and harmful technology, emphasizing the importance of ethical considerations in its application.

Uploaded by

praneet.ry
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 31

Assignment

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.

# Define robot categories in a nested dictionary


robots_data = {
"Features": ["Sensors", "Actuators", "Power Source", "AI", "Autonomy", "Mobility", "End
Effectors"],
"Applications": ["Industrial Automation", "Healthcare", "Agriculture", "Military &
Defense", "Household", "Space Exploration", "Entertainment"],
"Classification": {
"By Environment": ["Terrestrial", "Underwater", "Aerial", "Space"],
"By Configuration": ["Articulated", "SCARA", "Cartesian", "Cylindrical", "Spherical",
"Delta"],
"By Application": ["Industrial", "Service", "Medical", "Military", "Personal/Home"],
"By Mobility": ["Fixed", "Mobile", "Humanoids", "Swarm"],
"By Interaction": ["Autonomous", "Collaborative (Cobots)", "Social"]
}
}

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.

Variable Name Type Description

robots_data Dictionary Stores the categories and


subcategories of robots

Category String Represents the current


category being displayed

Choice Integer Stores the user’s choice


from the menu options

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:

Types of Errors in Python


1. Syntax Error
2. NameError
3. TypeError
4. IndexError
5. ValueError
6. ZeroDivisionError
7. Logical Error
8. ImportError
9. AttributeError
10. KeyError
Project 3:

A while loop in Python is a control


flow statement that allows repeated
execution of a block of code as long as
a specific condition remains true. It is
particularly useful when the number of
iterations is not predetermined and
depends on dynamic conditions that
change during runtime.
The while loop begins by checking the
condition. If the condition evaluates to
True, the block of code inside the loop
is executed. After each execution, the
condition is checked again, and if it
remains True, the loop continues. This
process repeats until the condition
evaluates to False, at which point the
loop terminates, and the program
moves on to the next set of
instructions outside the loop.
One common application of a while
loop is in situations where an action
must be repeated until a specific
condition is met, such as reading user
input until valid data is entered or
processing a sequence until a certain
threshold is reached.
For example, consider a scenario
where a counter is initialized at zero.
The loop will repeatedly increase the
counter value and print it, as long as
the counter remains below a given
limit. Once the counter reaches the
defined limit, the condition becomes
false, and the loop stops.
The versatility of the while loop lies in
its ability to handle indefinite
iterations, making it ideal for tasks
where the stopping point is not known
beforehand. However, care must be
taken to ensure that the condition will
eventually become false; otherwise,
the loop can run indefinitely, leading
to what is known as an infinite loop,
which could crash the program or
cause unwanted behavior.
In summary, the while loop is a
powerful tool in Python for repeated
execution based on dynamic
conditions, especially when the exact
number of repetitions is not known at
the outset.
Project 4 :

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)

student = Student(name, roll_number, marks)


self.students[roll_number] = student
print(f"Student {name} added successfully!\n")

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 check_scholarship(self, percentage):


if percentage >= 85:
print("Congratulations! You are eligible for a
scholarship.\n")
else:
print("Keep working hard for future
opportunities.\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")

choice = input("Enter your choice: ")

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")

# Start the program


main()
Project11:
PROJECT 12:
AI
PROJECT 1:
PROJECT 2:
AI is indeed a powerful tool that can
either be a blessing or a curse,
depending on its use, implementation,
and oversight. Let’s explore this
dichotomy with examples from various
fields:
AI as a Blessing
1. Healthcare: AI has
revolutionized medical diagnosis
and treatment. AI-powered
systems like IBM's Watson Health
help doctors analyze large datasets
of medical records and suggest
personalized treatment plans. For
example, AI can detect patterns in
radiological scans, aiding in early
detection of diseases like cancer.
This can lead to faster, more
accurate diagnoses and ultimately
save lives.
2. Education: AI-enhanced
educational tools personalize
learning experiences for students.
Platforms like Duolingo use AI
algorithms to adjust the difficulty of
language lessons based on a
learner’s progress. This makes
learning more engaging and
efficient, giving students tailored
content that fits their unique
needs.
3. Environment: AI is being used
to address pressing environmental
challenges. For instance, Google’s
AI-powered tools analyze satellite
images to detect illegal
deforestation in the Amazon
rainforest. By catching these
activities early, governments and
organizations can act swiftly to
prevent further damage to
ecosystems.
AI as a Curse
1. Job Displacement: While AI
improves efficiency, it can also lead
to widespread job loss. In
manufacturing and customer
service industries, automated
systems and robots are replacing
human workers. Companies like
Amazon have deployed AI-powered
robots in their warehouses, which,
though efficient, have raised
concerns about the future of
human employment in these
sectors.
2. Bias and Discrimination: AI
systems can perpetuate bias when
trained on biased data. For
example, studies have shown that
facial recognition systems can
struggle with accuracy when
identifying people of color. In law
enforcement, this can lead to
wrongful arrests or unfair profiling,
amplifying existing societal
inequalities.
3. Surveillance and Privacy: AI
can be used to invade privacy on
an unprecedented scale. China’s
use of AI-powered surveillance
systems in Xinjiang, for instance,
has led to mass monitoring of the
Uighur population, contributing to
reports of human rights abuses. In
this case, AI is not just an intrusive
tool but one that can facilitate
control and oppression.
Ethical Challenges
The ethical concerns surrounding AI
involve accountability, transparency,
and the potential for misuse. For
instance, deepfakes, AI-generated
videos that manipulate real footage,
have been used for political
disinformation and personal harm. If
such technology is misused, it can
undermine trust and harm individuals
or even destabilize democracies.
Conclusion
AI’s impact depends on how it is
applied. As a blessing, it can save
lives, enhance learning, and help fight
climate change. As a curse, it can
exacerbate inequality, displace
workers, and compromise privacy.
Balancing its use through thoughtful
regulation and ethical guidelines is
crucial to ensuring AI is a force for
good.

You might also like