PART 2 - Robotics AI Book Grade 9
PART 2 - Robotics AI Book Grade 9
Grade 9
PART 2
Robotics Ai
INTRODUCTION TO
THE WORLD OF ROBOTICS
1- Introduction to AI
2- Data and Information
3- Evolution of Computing
4- Introduction to Python
5- Introduction to Data Types and Variables
6- Introduction to Operators and Strings Data Types in Python
7- Applications and Benefits of AI
8- Ethical Considerations in AI
9- Conditional Statements
10 - Control Statements
11 - AI Concepts
12 - Components and Stages (AI Project Cycle)
13 - Functions
1|Page
Module 1: Introduction to AI
What is Intelligence?
Intelligence is a complex and multifaceted construct that involves various cognitive abilities, problem-
solving skills, adaptability, creativity, and the capacity to learn from experiences. While there isn't a
universally agreed-upon definition, intelligence generally refers to the ability to:
1. Reason: Intelligence involves the capacity to think logically, solve problems, and make decisions
based on available information.
2. Learn: Intelligent individuals are able to acquire new knowledge and skills, and apply them effectively
in different contexts.
3. Adapt: Intelligence includes the ability to adapt to new situations, learn from experiences, and adjust
behavior accordingly.
4. Understand: Intelligence encompasses the ability to comprehend complex ideas, concepts, and
relationships.
5. Create: Intelligent individuals often demonstrate creativity, originality, and the ability to generate
novel ideas or solutions.
6. Communicate: Intelligence involves the capacity to express oneself effectively through language,
symbols, or other forms of communication.
2|Page
Key aspects of Intelligence:
1. Reasoning and Problem-Solving: Intelligence involves the ability to reason logically, analyze
situations, and devise effective solutions to problems.
2. Learning and Adaptation: Intelligent systems can acquire knowledge from their experiences and
adjust their behavior accordingly.
3. Perception and Sensory Processing: Ability to perceive and interpret sensory information from the
environment.
4. Memory and Information Retention: Short-term memory for immediate processing and long-term
memory for retaining knowledge and experiences over time.
5. Communication and Language: Intelligence often involves the ability to communicate effectively
using natural language or other forms of communication.
6. Creativity and Innovation: Intelligence encompasses the capacity for creativity and innovation,
enabling individuals or systems to generate novel ideas, solutions, and perspectives.
7. Emotional Intelligence: In addition to cognitive abilities, intelligence may also include emotional
intelligence, which involves the ability to recognize, understand, and manage one's own emotions as
well as those of others.
8. Adaptability and Flexibility: Intelligent systems can adapt their behavior and strategies in response
to new information or changing circumstances.
• Human intelligence, a mental quality that consists of the abilities to learn from experience, adapt to
new situations, understand and handle abstract concepts and use knowledge to manipulate one’s
environment.
• Intelligence includes the ability to benefit from past experience, act purposefully, solve problems and
adapt to new situations.
• Humans are not the strongest or fastest or generally do not have great athletic abilities.
• Many animals like tiger, lion, cheetahs, crocodiles are much stronger than the strongest humans.
Deers, tigers, cheetah etc run faster than humans. Still the appropriate use of an intelligent mind can
conquer the strongest or fastest easily.
• Humans are generally considered the most intelligent species on Earth because of their large brains,
cognitive abilities, and processing power.
• Chimpanzees are the second most intelligent species on Earth, after humans. They share 98.7% of
their DNA with humans, and have complex social hierarchies and advanced problem-solving skills.
• Dolphins are quick learners that can mimic human behaviour, solve problems, teach others and
demonstrate self-awareness. Dolphins playing around to entertain themselves, including using shells
and other ocean objects as toys.
3|Page
• Octopuses are the eight-armed Houdinis of the animal kingdom with a remarkable ability to escape
human confinement. There are stories of octopuses figuring out how to break out of tanks and even
squirt water at overhead lights to turn them off.
• We all know how smart our pets can be. Dogs and cats let us know what they want and seemingly
manipulate us into getting their own way. Researchers discovered in 2017 that dogs have twice the
number of neurons in their cerebral cortexes than cats, which should give them a cognitive advantage
and confirm anecdotal reports that dogs are easier to train.
Types of Intelligence:
There are several theories and models of intelligence, each proposing different types or components of
intelligence. One of the most well-known theories is Howard Gardner's theory of multiple intelligences,
which suggests that there are several distinct types of intelligence, rather than a single general
intelligence factor (often referred to as "g" in traditional intelligence theories). Here are the types of
intelligence proposed by Gardner:
1. Linguistic Intelligence: This refers to the ability to understand and manipulate language effectively.
Writers, poets, speakers, and journalists often exhibit strong linguistic intelligence.
2. Logical-Mathematical Intelligence: This involves the ability to think logically and solve mathematical
problems. Scientists, mathematicians, engineers, and economists often exhibit strong logical-
mathematical intelligence.
3. Spatial Intelligence: This is the ability to visualize and manipulate objects in space. Artists, architects,
navigators, and chess players often exhibit strong spatial intelligence.
4. Musical Intelligence: This refers to sensitivity to rhythm, pitch, melody, and tone. Musicians,
composers, and conductors often exhibit strong musical intelligence.
5. Bodily-Kinesthetic Intelligence: This involves the ability to use one's body effectively to solve
problems and complete tasks. Athletes, dancers, actors, and surgeons often exhibit strong bodily-
kinesthetic intelligence.
4|Page
6. Interpersonal Intelligence: This refers to the ability to understand and interact effectively with
others. Teachers, therapists, salespeople, and politicians often exhibit strong interpersonal
intelligence.
7. Intrapersonal Intelligence: This involves self-awareness and understanding one's own emotions,
motivations, and goals. Philosophers, psychologists, theologians, and writers often exhibit strong
intrapersonal intelligence.
8. Naturalistic Intelligence: This is sensitivity to and understanding of the natural world, including
plants, animals, and ecosystems. Biologists, environmentalists, farmers, and botanists often exhibit
strong naturalistic intelligence.
• Yes !!!
• Since the advent of computers, thanks to the dedication of numerous talented and industrious
scientists and engineers, the aspiration for intelligent machines remained a distant aspiration until
the inception of the first computer.
• In the past, computers primarily functioned as computational devices. They imitated human
capacity to manipulate symbols to execute fundamental arithmetic operations like addition.
Subsequently, the integration of logical reasoning endowed computers with the ability to engage in
mathematical reasoning through comparisons.
• However, humans still had to formulate the algorithms necessary for computational tasks, furnish
the requisite data in appropriate formats, and then interpret the outcomes.
• Alan Turing delineated intelligent computer behavior as the capability to achieve cognitive
performance comparable to that of humans in a given task.
When we hear "AI" (Artificial Intelligence), we think of machines and computers that can learn and
make decisions like humans.
1. Smart assistants like Siri or Alexa that can understand voice commands and answer questions.
2. Self-driving cars that navigate roads and avoid obstacles on their own.
3. Robots in factories or healthcare, performing tasks without human guidance.
4. Algorithms that recommend movies, products, or news based on your preferences.
5. Chatbots that help people with customer service questions.
5|Page
What is AI?
• Weak AI (Narrow AI): Also known as Narrow AI or Artificial Narrow Intelligence, this type of AI is
designed to perform a specific task or a set of closely related tasks.
• Strong AI: This type of AI can perform more complex and human-like tasks.
6|Page
Narrow AI (Weak AI):
• Narrow AI, also known as Weak AI, is a type of
artificial intelligence (AI) system that is designed to
perform specific tasks or applications. Narrow AI
systems are highly specialized and lack versatility,
being limited to predefined tasks and cannot
generalize knowledge.
• Narrow AI can automate tasks that are time-
consuming and repetitive, which can free up
employees to focus on more important
tasks. However, narrow AI lacks the "common
sense" aspect, or a sense of fairness and equity.
• Narrow AI is the most common type of AI that we
encounter in our daily lives, and is used in many
industries, including healthcare, finance, manufacturing, and retail.
• Specialized Functionality: Weak AI performs specific tasks (e.g., facial recognition, language
translation) but cannot operate outside its programming.
• Lack of General Intelligence: It follows programmed rules, lacks self-awareness, and cannot think
creatively or reason like humans.
• Data-Driven Learning: Relies on machine learning from large datasets to make predictions or
decisions (e.g., speech recognition, recommendations).
• No Real Understanding: Processes information without true comprehension, following patterns
without understanding their meaning (e.g., playing chess without knowing why winning matters).
• Digital Voice Assistants: Siri and Alexa are examples of Weak AI that classify data and respond
quickly to queries.
• Recommendation Engines: Netflix, Amazon, and other sites use AI to suggest movies or products
based on user behavior.
• Search Engines: Google and other search engines use AI algorithms to classify queries and provide
relevant answers.
• Chatbots: AI-driven chatbots handle common questions for organizations, freeing humans for
higher-level tasks.
• Autonomous Vehicles: Self-driving cars use Weak AI to perform programmed driving functions, but
they require extensive training for potential hazards.
• Image and Speech Recognition: Weak AI helps with medical image analysis, speech recognition, and
translation services like Google Translate.
• Predictive Maintenance: AI analyzes historical data to predict equipment maintenance needs and
future outcomes.
• Robots: Robots, drones, and delivery bots use AI to perform predefined tasks, such as
manufacturing or disinfecting during the pandemic.
7|Page
General AI:
• General artificial intelligence (AGI) is a theoretical system that describes a machine's ability to learn,
understand, and apply information across a wide range of areas and tasks, similar to human
intellect.
• Artificial general intelligence (AGI) is the intelligence of machines that allows them to comprehend,
learn, and perform intellectual tasks much like humans.
• With AGI, machines can emulate the human mind and behavior to solve any kind of complex
problem. Being designed to have comprehensive knowledge and cognitive computing capabilities,
the performance of these machines is indistinguishable from that of humans
8|Page
Key Features of General AI:
• Solving New Problems: General AI applies learned information to tackle unfamiliar problems and
diverse tasks.
• Human-like Thinking: It can think, reason, and respond intelligently, similar to human cognitive
abilities.
• Adapting to Changing Contexts: General AI adjusts to new environments without reprogramming,
performing various tasks.
Example:
9|Page
1. Reactive Machine AI
Reactive machines are AI systems with no memory and are designed to perform a very specific task.
Since they can’t recollect previous outcomes or decisions, they only work with presently available data.
Reactive AI stems from statistical math and can analyze vast amounts of data to produce a seemingly
intelligence output.
• IBM Deep Blue: IBM’s chess-playing supercomputer AI beat chess grandmaster Garry Kasparov
in the late 1990s by analyzing the pieces on the board and predicting the probable outcomes of
each move
• The Netflix Recommendation Engine: Netflix’s viewing recommendations are powered by models
that process data sets collected from viewing history to provide customers with content they’re
most likely to enjoy
2. Limited Memory AI
Unlike Reactive Machine AI, this form of AI can recall past events and outcomes and monitor specific
objects or situations over time. Limited Memory AI can use past- and present-moment data to decide
on a course of action most likely to help achieve a desired outcome. However, while Limited Memory AI
can use past data for a specific amount of time, it can’t retain that data in a library of past experiences
to use over a long-term period. As it’s trained on more data over time, Limited Memory AI can improve
in performance.
• Generative AI: Generative AI tools such as ChatGPT, Bard and DeepAI rely on limited memory AI
capabilities to predict the next word, phrase or visual element within the content it’s generating
• Virtual assistants and chatbots: Siri, Alexa, Google Assistant, Cortana and IBM Watson Assistant
combine natural language processing (NLP) and Limited Memory AI to understand questions and
requests, take appropriate actions and compose responses
• Self-driving cars: Autonomous vehicles use Limited Memory AI to understand the world around
them in real-time and make informed decisions on when to apply speed, brake, make a turn, etc.
3. Theory of Mind AI
• Theory of Mind AI is a functional class of AI that falls underneath the General AI. Though an
unrealized form of AI today, AI with Theory of Mind functionality would understand the
thoughts and emotions of other entities.
• This understanding can affect how the AI interacts with those around them. In theory, this
would allow the AI to simulate human-like relationships. Because Theory of Mind AI could infer
human motives and reasoning, it would personalize its interactions with individuals based on
their unique emotional needs and intentions.
10 | P a g e
• Theory of Mind AI would also be able to understand and contextualize artwork and essays,
which today’s generative AI tools are unable to do.
• Emotion AI is a theory of mind AI currently in development. AI researchers hope it will have the
ability to analyze voices, images and other kinds of data to recognize, simulate, monitor and
respond appropriately to humans on an emotional level. To date, Emotion AI is unable to
understand and respond to human feelings.
4. Self-Aware AI
• Self-Aware AI is a kind of functional AI class for applications that would possess super AI
capabilities. Like theory of mind AI, Self-Aware AI is strictly theoretical. If ever achieved, it
would have the ability to understand its own internal conditions and traits along with human
emotions and thoughts. It would also have its own set of emotions, needs and beliefs.
• Emotion AI is a Theory of Mind AI currently in development. Researchers hope it will have the
ability to analyze voices, images and other kinds of data to recognize, simulate, monitor and
respond appropriately to humans on an emotional level. To date, Emotion AI is unable to
understand and respond to human feelings.
• AI can analyze information and make decisions faster and with fewer errors than humans. AI can
also process information more efficiently than humans.
• AI is highly accurate and becomes more precise the more it is used.
• AI can quickly learn new tasks by trial and error, rather than needing instruction manuals or
feedback from humans.
• AI is reliable and can be implemented 24/7.
• AI is more permanent and consistent than human intelligence.
• AI is less expensive and easier to duplicate and disseminate than human intelligence.
• AI is better at recognizing patterns than humans.
• AI can digest huge samples in a short period of time and avoid potential errors in repetitive and
tedious work.
• AI can help generate new ideas, improve the creative process, and create new forms of art.
11 | P a g e
• AI algorithms can be used for social manipulation.
• AI technology can be used for social surveillance.
• AI tools can lead to a lack of data privacy.
• AI can weaken ethics and goodwill.
• AI can be expensive to implement, requiring investment in hardware, software, and training
teams.
• AI algorithms can be complex and difficult to understand.
• AI systems can be vulnerable to hacking.
• Artificial intelligence (AI) is a rapidly evolving field that is revolutionizing the way we live and
work. However, few people are aware that AI's progress is highly dependent on human
collaboration. Behind every AI system is a dedicated developer team responsible for its creation,
maintenance, and enhancement.
• Although Artificial Intelligence (AI) is a powerful tool that may aid companies in many industries
in making better strategic decisions, it is becoming increasingly clear that human interaction is
still necessary as AI’s capabilities increase.
• Though AI and machine learning tools have grown to the point where they are trusted with
important jobs and judgments, technology is still not at a position where it can completely
imitate the human mind and decision-making process.
• Artificial intelligence (AI) cannot exist without people, hence humans and AI cannot be
substituted.
• When sufficient data is available, the AI can produce a result that matches the mathematical
basis of the input data. However, the AI can’t produce a new data, create solutions based on that
data, imagine new ways of working with that data, or provide ideas for implementing a solution.
All these activities reside within the human realm.
• Anything that requires imagination creativity, the discernment of truth, the handling of opinion,
or the creation of an idea is best left to humans.
12 | P a g e
13 | P a g e
Father of AI:
• In the mid-1950s, McCarthy defined AI as "the science and engineering of making intelligent
machines" and coined the term at a Dartmouth College conference in 1956.
• Other "founding fathers" of AI include Alan Turing, Marvin Minsky, and Allen Newell.
Turing Test:
The Turing Test, proposed by Alan Turing in 1950, is a criterion for determining whether a machine
exhibits intelligent behavior equivalent to, or indistinguishable from, that of a human.
In a typical Turing Test scenario, three participants are involved: two humans and one machine.
14 | P a g e
The test is conducted as follows:
• Setup: A human evaluator interacts with two entities through a text-based interface—one is a
human, and the other is a machine (an AI program). The evaluator does not know which is which.
• Interaction: Through text-based communication, the evaluator can ask questions or engage in
conversation with both the human and the machine.
• Objective: If the evaluator cannot reliably distinguish which entity is the machine based on the
responses received, then the machine is said to have passed the Turing Test and demonstrated
human-like intelligence.
The use and importance of the Turing Test can be summarized as follows:
1. Benchmark for AI: The Turing Test serves as a benchmark for evaluating the progress and capabilities
of AI systems. If a machine can successfully pass the test, it demonstrates a level of intelligence
comparable to human intelligence in conversational abilities.
2. Conceptual Foundation: The Turing Test laid the foundation for the field of AI by proposing a practical
and operational definition of intelligence. It shifted the focus from philosophical debates about
consciousness and cognition to empirical testing and demonstration of intelligent behavior.
3. Motivation for Research: The challenge posed by the Turing Test motivates researchers to develop
AI systems capable of human-like interaction, reasoning, and understanding. It drives advancements
in natural language processing, machine learning, and cognitive modelling.
4. Ethical Considerations: The Turing Test raises ethical questions about the implications of creating
machines that can mimic human behavior. It prompts discussions about the nature of intelligence,
consciousness, and the potential societal impact of advanced AI technologies.
5. Limitations and Criticisms: While the Turing Test is a useful concept, it has been criticized for various
reasons. Critics argue that passing the test does not necessarily indicate true intelligence or
understanding, as it primarily assesses surface-level behavior rather than internal cognitive
processes. Additionally, the Turing Test focuses on linguistic abilities and may not capture other
aspects of intelligence, such as creativity, emotion, or physical interaction.
Decision Making:
• Human Judgment in the Past: Business decisions were based on human intuition, experience, and
gut instinct.
• Role of Information in Decision Making: Good decisions depend on past experience, intuition,
knowledge, and self-awareness.
• One-Way Door Decisions: Difficult to reverse, requiring caution.
• Two-Way Door Decisions: Easily reversible, allowing faster decision-making and automation.
• Main Point: Decision-making is shifting from intuition-based methods to data-driven, automated
processes, especially for reversible decisions.
15 | P a g e
Let’s look at the different scenario:
Scene 1: You are locked inside a room with 3 doors to move out of the locked room and you need to find
a safe door to get your way out. Behind the first door is a lake with deadly shark. The second door has a
mad psychopath ready to kill with a weapon and the third one has a lion that has not eaten since last 2
months.
Ans: Ans. The answer is gate number 3. The reason being that since the lion has not eaten for 2 months,
he would not have survived till now and would already be dead. This makes going out from gate 3 the
correct option. The above scenario shows that information is crucial for making decision.
Scene 2: In a large departmental store, an empty elevator begins its journey on the ground floor. At the
ground floor, four people get in, including me. On the first floor, one person gets out and five more
people get in. On the second floor no one gets out and ten more people gets in.
As the elevator rises towards the third floor, its cable snaps and it falls down the shaft, crashing to the
floor at bottom, Everyone dies in the elevator, but I am alive. How did I survive?
Ans: I was the one person to leave the elevator at the first floor. I was therefore not in the lift when it
crashed and I survived.
Not everything that operates automatically is considered AI. There’s a distinct difference between AI-
powered technology and simple automation. A machine is classified as AI if it can learn from data or
experiences and make decisions or predictions. In contrast, if a machine only performs tasks based on
present instructions, it’s merely automated, not AI.
Examples:
• Automatic Toy Car: A toy car controlled via remote is not AI, as it requires human control. In
comparison, AI8u systems like self-driving cars can sense their surroundings and operate
autonomously.
• Automatic Washing Machine: Although a fully automatic washing machine runs independently, it
still needs human input to set the washing mode and start the cycle. This makes it automated, not
AI.
• Smart TV: While a smart TV can access online content, it depends on users to choose shows or
settings. This reliance on user action makes it automated, not AI.
• Digital Alarm Clocks: These clocks can perform set functions like multiple alarms and brightness
adjustment, but they don’t learn from use. Therefore, they are examples of automation rather
than AI.
16 | P a g e
Domains of AI:
Speech recognition or
NLP is a sub-domain of Voice recognition
Data is a collection of enables Conversational
AI that enables
raw facts which can be AI and other related
computers to
processed to
understand, interpret, applications. Computer
make Information out
and generate human Vision is linked to Image
of it. Data Science is all
language. For example, and Video Recognition
about applying
a machine can learn and analysis.
mathematical and
how users intend to In simple terms, this is a
statistical principles on
communicate and technology of AI with
data
respond accordingly. which the robots can
see.
1-Data:
Data refers to information or instructions about an entity (such as students, schools, sports, businesses,
animals, etc.) that can be processed or communicated by humans or machines. Data is essentially a
collection of facts, which could include numbers, words, images, audio, videos, maps, measurements,
observations, or descriptions. Data can be represented through various characters like letters (A-Z, a-z),
digits (0-9), or special symbols (+, -, /, ", <, >, =, etc.).
Structured data refers to information that has specific formats and data types. It is well-organized and
easy to analyze. Examples include names, dates, addresses, credit card details, stock information,
geolocation, and so on.
On the other hand, unstructured data has no fixed size or predefined data type. It cannot be processed
using traditional relational databases (RDBMS). Examples of unstructured data include text, videos,
audio, mobile activities, social media interactions, satellite images, and surveillance footage. For
example, a Facebook post can contain text, pictures, videos, and audio — all of which don’t have a fixed
data type.
Human language is complex, ambiguous, disorganized, and diverse. There are more than 6,500
languages in the world, all of them with their own syntactic and semantic rules.
17 | P a g e
Natural language processing (NLP) is the ability of a computer program to understand human language
as it's spoken and written -- referred to as natural language. It's a component of artificial intelligence.
NLP uses many different techniques to enable computers to understand natural language as humans do.
Whether the language is spoken or written, natural language processing can use AI to take real-world
input, process it and make sense of it in a way a computer can understand. Just as humans have different
sensors -- such as ears to hear and eyes to see -- computers have programs to read and microphones to
collect audio. And just as humans have a brain to process that input, computers have a program to
process their respective inputs. At some point in processing, the input is converted to code that the
computer can understand.
Example of NLP:
1. Email filters: NLP is used to filter spam and sort emails into folders.
2. Voice assistants: NLP helps voice assistants understand the intent behind a query and provide
relevant products or services. For example, a customer might say "I want to buy a new pair of
running shoes" and the voice assistant will provide a list of relevant products.
3. Duplicate detection: NLP helps collate content that has been re-published on multiple sites to
display a variety of search results.
4. Auto-correct: NLP helps find the right search keywords if you misspelled something, or used a
less common name.
5. Grammar checkers: NLP helps ensure you use punctuation correctly and alert if you use the
wrong article or proposition.
18 | P a g e
3- Computer Vision (CV):
• Computer vision is a field of artificial intelligence (AI) that uses machine learning and neural
networks to teach computers and systems to derive meaningful information from digital images,
videos and other visual inputs—and to make recommendations or take actions when they see
defects or issues.
• Computer vision works much the same as human vision, except humans have a head start. Human
sight has the advantage of lifetimes of context to train how to tell objects apart, how far away they
are, whether they are moving or something is wrong with an image.
• Computer vision trains machines to perform these functions, but it must do it in much less time with
cameras, data and algorithms rather than retinas, optic nerves and a visual cortex. Because a system
trained to inspect products or watch a production asset can analyze thousands of products or
processes a minute, noticing imperceptible defects or issues, it can quickly surpass human
capabilities.
Example of CV:
19 | P a g e
History of AI:
1950
1952
neural networks introduces a test-the computer scientist,
established by Turing test-as a way developed a
Warren McCulloch of testing a checkers-playing
and Walter Pitts, machine's computer program -
drawing parallels intelligence. the first to
between the brain independently learn
and computing how to play a game.
machines.
1965
1966
developed LISP (LISt a computer scientist developed by Charles
Processing), the most and professor, Rosen with the help
popular and still the developed ELIZA, an of 11 others, was the
favourite interactive computer first general purpose
programming program that could mobile robot, also
language for artificial functionally converse known as the first
intelligence research. in English with a electronic person.
person.
1980
1984
20 | P a g e
Mercedes-Benz built Computer scientist Deep Blue, a chess-
1986
1995
1997
and released a Richard Wallace playing computer
driverless van under developed the developed by IBM
the direction of Ernst chatbot A.L.I.C.E. became the first
Dickmanns, (Artificial Linguistic computer to win a
equipped with Internet Computer chess game and
cameras and sensors. Entity), inspired by match against a
Weizenbaum's ELIZA. reigning world
champion, Garry
Kasparov.
2002
2004
ASIMO, an artificially Roomba, an exploration rovers
intelligent humanoid autonomous robot Spirit and
robot. It is currently vacuum cleaner that Opportunity navigate
displayed in the cleans while avoiding Mars' surface
Miraikan museum in obstacles. without human
Tokyo, Japan. intervention.
2009
2011
21 | P a g e
Microsoft released Google DeepMind's A humanoid robot
2014
2015-17
2016
Cortana, their AlphaGo, a computer named Sophia was
version of a virtual program that plays created by Hanson
assistant similar to the board game Go, Robotics. She is
Siri on IOS. defeated various known as the first
Amazon created (human) champions. robot citizen. What
Amazon Alexa, a distinguishes Sophia
home assistant that from previous
developed into smart humanoids is her
speakers that likeness to an actual
function as personal human being, with
assistants. her ability to see,
make facial
expressions and
communicate
through Al.
2021
2018
2020
EXERCISE
22 | P a g e
2. Due to which of these abilities has human beings emerged as the dominant species on Earth?
(a) Great strength (b) Great speed
(c) Great size (d) High Intelligence
3. Which of the following animals is known to be able to mimic human words?
(a) Dolphins (b) Tiger
(c) Dogs (d) Parrots
4. Which of these animals can identify itself when seen in a mirror?
(a) Dogs (b) Elephants
(c) Tiger (d) Dolphins
5. Which of the following activities involves use of Al technology?
(a) Sorting of emails into folders based on content
(b) Booting up the computer
(c) Adding up numbers using calculator
(d) Changing colored photographs into black and white
6. Which of the following is NOT true about Al?
(a) Use of Al allows business owners to earn more money
(b) Al can replace humans in clerical or repetitive tasks
(c) John McCarthy coined the term Artificial Intelligence
(d) Development of Al systems have started only in last 10 years
7. Which of the following is NOT a sign of intelligence?
(a) Solve problems (b) Creating a poem
(c) Writing an original story (d) Taking bath
8.__________________is a field of computer science that works on enabling computers to see, identify
and process images in the same way that human vision does, and then provides appropriate output.
9. _________________is a branch of artificial Intelligence that deals with the interaction between
computers and humans using the natural language.
23 | P a g e
10. Al is abbreviated as________________.
B. STATE TRUE/FALSE
5. Driverless cars are the next big thing in the automobile space.
6. Roomba is an autonomous robot vacuum cleaner that cleans while avoiding obstacles.
7. Watson, a natural language question answering computer, defeated two former Jeopardy champions.
4. A robot called ________________ recognizes and simulates emotions with its face.
8. ___________________ uses a natural language user interface to infer, observe, answer and
recommend things to its human user on IOS.
24 | P a g e
D. DECIDE WHETHER AI OR NOT
1. Google Maps for finding the fastest route from your home to your friend's house.
Yes No Maybe
2. Image editing softwares that allows you to edit the brightness, colour and contrast in a picture.
Yes No Maybe
3. A Google Sheet that determines batting averages based on a given data set.
Yes No Maybe
4. Name any three animals that are much stronger than the strongest human.
F. SUBJECT ENRICHMENT
1. Multiple Intelligences Test: Read each statement. If it expresses some characteristic of yours and
sounds true for the most part, jot down a "T." If it doesn't, mark an "F." If the statement is sometimes
true, sometimes false, leave it blank.
1. __________________ I'd rather draw a map than give someone verbal directions.
2. __________________ I can play (or used to play) a musical instrument.
3. __________________ I can associate music with my moods.
4. __________________ I can add or multiolv in my head.
5. __________________ I like to work with calculators and computers.
6. __________________ I pick up new dance steps fast.
7. __________________ It's easy for me to say what I think in an argument or debate.
8. __________________ I enjoy a good lecture, speech or sermon.
9. __________________ I always know north from south no matter where I am.
10. __________________ Life seems empty without music.
11. __________________ I always understand the directions that come with new gadgets or
appliances.
12. __________________ I like to work puzzles and play games.
13. __________________ Learning to ride a bike (or skates) was easy.
14. __________________ I am irritated when I hear an argument or statement that sounds illogical.
15. __________________ My sense of balance and coordination is good.
16. __________________ I often see patterns and relationships between numbers faster and easier
than others.
25 | P a g e
17. __________________ I enjoy building models (or sculpting).
18. __________________ I'm good at finding the fine points of word meanings.
19. __________________ I can look at an object one way and see it sideways or backwards just as
easily.
20. __________________ I often connect a piece of music with some event in my life.
21. __________________ I like to work with numbers and figures.
22. __________________ Just looking at shapes of buildings and structures is pleasurable to me.
23. __________________ I like to hum, whistle and sing in the shower or when I'm alone.
24. __________________ I'm good at athletics.
25. __________________ I'd like to study the structure and logic of languages.
26. __________________ I'm usually aware of the expression on my face.
27. __________________ I'm sensitive to the expressions on other people's faces.
28. __________________ I stay "in touch" with my moods. I have no trouble identifying them.
29. __________________ I am sensitive to the moods of others.
30. __________________ I have a good sense of what others think of me.
Place a check mark by each item you marked as "true." Add your totals. A total of four in any of the
categories A through E indicates strong ability. In categories F and G a score of one or more means you
have abilities as well.
B E F G
C D
A Linguistic Logical Bodiy Intra Inter
Musical Spatial
Mathematical Kinesthetic personal personal
6
7________ 4_________ 2________ 1 ________ 26 _______ 27 _______
_________
8 ________ 5 _________ 3 ________ 9 ________ 13________ 28 _______ 29 _______
2. Visit https://experiments.withgoogle.com/scroobly
With Scroobly, you are using artificial intelligence as a creative tool to become a digital animator, even
if you've never written code or taken a design class.
26 | P a g e
G. ASSESSMENT
1. Do you think replacing machines in place of Artists would be a good idea? Give points for and against
the idea. Discuss the points in class.
(b) Let’s get imaginative and create an intelligent car. It is the year 2050. Add features to create a
car that races against time. Both the groups should give their inputs.
H. KNOWLEDGE HUB
1. https://www.g2.com/articles/history-of-artificial-intelligence
I. EXPERIENTIAL LEARNING
1.https://slidemodel.com/gardners-theory-8-multiple-intelligences/
2. https://youtu.be/3wLqsRLvV-c
27 | P a g e
Module 2: Data and Information
What is Data?
• Data is a collection of information gathered by observations, measurements, research or
analysis. They may consist of facts, numbers, names, figures or even description of things. Data
is organized in the form of graphs, charts or tables.
• It can be often generated anywhere where any information is generated and stored in structured
or unstructured formats.
Importance of Data:
28 | P a g e
• Data helps in solving problems by finding the reason for underperformance:
When things don’t go as planned, data can reveal where the issues lie. For instance, if a sales team
is underperforming, data on customer interactions, conversion rates, and market conditions might
show areas needing improvement.
• Data helps to evaluate performance:
Performance metrics, such as sales figures, productivity levels, and financial results, are all driven
by data. Regularly assessing these figures enables businesses or individuals to track progress and
make necessary adjustments to strategies or practices.
• Data helps improve processes:
By analyzing workflows and outcomes, data helps identify inefficiencies in processes. This allows
businesses to optimize production, reduce costs, and improve overall performance. For instance, in
manufacturing, data on production times and defect rates can help streamline operations.
• Data helps understand consumers and the market:
Through consumer behavior analysis, such as purchasing patterns and preferences, businesses can
tailor their products and services to better meet customer needs. Understanding the market trends
also allows companies to remain competitive and anticipate future demands.
• Data is the foundation of research in sciences, social sciences, and humanities:
In research, data serves as the basis for making discoveries, testing hypotheses, and drawing
conclusions. In the natural sciences, data from experiments and observations lead to new scientific
theories. In social sciences, data on human behavior helps in understanding societal trends.
• Data is used to train machine learning models and automate processes:
In the field of Artificial Intelligence, data is essential for training machine learning models. The more
diverse and comprehensive the data, the better the model performs in recognizing patterns, making
predictions, and automating complex tasks.
In today’s digital age, data plays a critical role in various aspects of our lives.
Data in Healthcare:
Data is revolutionizing the healthcare industry by enhancing patient care and operational efficiency. Key
applications include:
1. Electronic Health Records (EHRs): EHRs compile
comprehensive patient information such as
medical history, medications, allergies, and test
results. This data is accessible to authorized
healthcare providers, enabling them to make
informed treatment decisions, deliver personalized
care, reduce complications, and improve patient
outcomes.
2. Healthcare Operations: Data analytics optimize
healthcare operations by managing resources,
reducing costs, and improving patient flow.
Analyzing factors like patient wait times,
appointment scheduling, and staffing levels
enhances efficiency and reduces wait times, leading
to better patient experiences.
29 | P a g e
Data in Education:
• Data analysis helps teachers understand their students' learning abilities and challenges, and
facilitates an ingrained cultural process that uses detailed inputs (information) to ensure optimal
outputs (results for students).
• Data from student interactions with educational software is used to tailor content and pacing to
individual learning needs.
• Data from quizzes, tests, and assignments is used to evaluate student understanding and
progress.
• Data-driven insights support the adoption of innovative teaching methods and practices.
• Analysis of data supports the design and implementation of interventions aimed at
disadvantaged or underrepresented students.
30 | P a g e
Data in other fields:
• Business: Data is essential for businesses to make informed decisions. By using data analytics,
companies can identify patterns and trends in customer behavior, market dynamics, and
operational performance. This information helps improve customer experiences, optimize
operations, and uncover new growth opportunities.
• Personal finance management: Data is crucial for personal finance management. Banks and
financial institutions analyze data on transactions, spending habits, and credit scores to make
decisions about loans and investments. Individuals can use this data to track spending, identify
savings opportunities, and make informed financial decisions.
• Social Media Platform: Social media platforms collect and analyze data on user behavior, interests,
and preferences to personalize experiences, target ads, and identify online trends. This data helps
monitor and address cyberbullying, hate speech, and misinformation. Overall, data is crucial for
enhancing user engagement, optimizing ad targeting, and increasing revenue.
• Travel Industries: Data is increasingly used in the travel industry to enhance the traveler
experience. Travel companies analyze past bookings, search queries, and browsing behavior to
make personalized recommendations for flights, accommodations, and activities, tailored to
individual interests and preferences.
Types of Data:
Data can be categorized in various ways depending on its nature, source, and the way it's processed. The
most common classifications include:
1. Based on Structure:
a) Structured Data:
• Definition: This type of data is organized in a fixed format or structure. It is typically stored in
databases and spreadsheets with clear rows and columns.
• Examples: Numbers, dates, addresses, product names, transaction records.
• Use Case: Structured data is commonly used in business reporting, financial data, and databases
where fast retrieval and analysis are needed.
b) Unstructured Data:
• Definition: This refers to data that doesn’t have a predefined format. It is often qualitative and
cannot be neatly stored in a database.
• Examples: Emails, social media posts, images, videos, word documents.
• Use Case: Unstructured data is widely used in text analysis, image recognition, and social media
monitoring, where advanced tools (like AI) process it to extract valuable insights.
c) Semi-structured Data:
• Definition: Data that doesn’t have a strict format but is somewhat organized using tags or
markers. It falls between structured and unstructured data.
• Examples: XML files, JSON, emails (with metadata like subject and sender).
31 | P a g e
• Use Case: Semi-structured data is often used in web development and APIs, where some
structure helps in parsing and retrieving data.
2. Based on Source:
a) Primary Data:
• Definition: This is data that is collected firsthand by the researcher or organization for a specific
purpose. It is original and directly gathered from the source.
• Examples: Surveys, experiments, observations, interviews.
• Use Case: Primary data is crucial in research studies, product testing, and scientific experiments
where specific, targeted information is needed.
b) Secondary Data:
• Definition: This is data that has been collected by someone else and is available for use by others.
It can be obtained from existing records, databases, or studies.
• Examples: Government reports, published research, company financial records, historical data.
• Use Case: Secondary data is used for market analysis, academic research, and policy formulation,
where time or resources don’t allow for primary data collection.
3. Based on Nature:
a) Quantitative Data:
• Definition: This type of data is numerical in nature and can be measured and counted. It answers
the question of “how much” or “how many.”
• Examples: Revenue, temperature, age, height, test scores.
• Use Case: Quantitative data is used in scientific experiments, business reporting, and financial
analysis, where metrics are crucial.
• Quantitative data is further classified into two categories that are,
i. Discrete Data : Discrete data type is a type of data in statistics that only uses Discrete Value
or Single Values. These data types have values that can be easily counted as whole numbers.
The example of the discrete data types are, Height of Students in a class, Marks of the
students in a class test, Weight of different members of a family, etc.
32 | P a g e
ii. Continuous Data: Continuous data is the type of the quantitative data that represent the
data in a continuous range. The variable in the data set can have any value between the
range of the data set.
Examples of the continuous data types are, Temperature Range, Salary range of Workers in
a Factory, etc.
b) Qualitative Data:
• Definition: This type of data is descriptive and subjective. It describes qualities or characteristics
and is often more difficult to measure than quantitative data.
• Examples: Customer feedback, interview responses, opinions, color descriptions.
• Use Case: Qualitative data is key in understanding behaviors, preferences, and perceptions,
commonly used in marketing research and social sciences.
• Qualitative data is further categorized into two categories that includes,
i. Nominal Data: Nominal data is a type of data that consists of categories or names that cannot
be ordered or ranked. Nominal data is often used to categorize observations into groups, and
the groups are not comparable. In other words, nominal data has no inherent order or ranking.
Examples of nominal data include gender (Male or female), race (White, Black, Asian), religion
(Hinuduism, Christianity, Islam, Judaism), and blood type (A, B, AB, O).
Nominal data can be represented using frequency tables and bar charts, which display the
number or proportion of observations in each category. For example, a frequency table for
gender might show the number of males and females in a sample of people.
ii. Ordinal Data: Ordinal data is a type of data that consists of categories that can be ordered or
ranked. However, the distance between categories is not necessarily equal. Ordinal data is
often used to measure subjective attributes or opinions, where there is a natural order to the
responses. Examples of ordinal data include education level (Elementary, Middle, High School,
College), job position (Manager, Supervisor, Employee), etc.
Ordinal data can be represented using bar charts, line charts. These displays show the order
or ranking of the categories, but they do not imply that the distances between categories are
equal.
4. Based on Format:
a) Text Data:
b) Image/Video Data:
33 | P a g e
5.Time Series data:
• Data collected over time with observations recorded at specific intervals.
• Often represented by a line graph to show trends, patterns, and relationships over time.
• Examples: Stock prices, monthly rainfall, hourly temperature readings, annual GDP figures.
• Used to analyze trends, forecast future values, and identify seasonal patterns.
• Common in economics, finance, weather forecasting, and traffic analysis.
• Collection Methods: Sensors, financial markets, and manual recording over time.
6. Spatial Data:
• Data with a geographic or spatial component, linked to specific locations on Earth.
• Represented as points, lines, polygons, or raster images in maps.
• Examples: Maps of crime rates, restaurant locations, plant species distributions, GPS
coordinates.
• Collected through satellite imagery, aerial photography, GPS, and remote sensing technologies.
• Analyzed using Geographic Information Systems (GIS) and remote sensing software.
• Uses: Urban planning, natural resource management, environmental studies, transportation
planning, and navigation systems.
• Helps in analyzing geographic features, terrain, buildings, roads, and vegetation patterns.
34 | P a g e
• Audience Analysis: Data on viewer demographics and preferences guides content creation.
• Social Media: Engagement metrics track user interactions and optimize content delivery.
7. Environmental Monitoring
• Weather Forecasting: Data from satellites and sensors predicts weather conditions.
• Climate Research: Long-term data tracks environmental changes and informs policy.
• Natural Disaster Response: Data helps in preparing for and responding to events like
earthquakes and floods.
8. Sports and Fitness
• Performance Analysis: Athletes use data to improve training and performance.
• Fan Engagement: Sports teams use data to enhance the fan experience through personalized
content.
• Fitness Tracking: Wearable devices track health metrics like steps, heart rate, and sleep patterns.
9. Urban Planning
• Infrastructure Development: Data on population growth and movement informs city planning.
• Public Services: Data helps in the efficient delivery of services like waste management and
utilities.
• Safety and Security: Crime data aids in law enforcement and community safety measures.
10. Agriculture
• Precision Farming: Data from sensors and drones optimizes planting, watering, and harvesting.
• Supply Chain Management: Data tracks the movement of agricultural products from farm to
market.
• Crop Monitoring: Satellite and sensor data monitor crop health and yield predictions.
11. Energy
• Grid Management: Data from smart grids ensures stable and efficient energy distribution.
• Renewable Energy: Data optimizes the performance of solar panels and wind turbines.
• Consumption Analysis: Usage data helps in developing energy-saving strategies for consumers
and businesses.
What is Information?
• Information is processed, organized, and structured data.
• It adds context to raw data, making it meaningful and useful.
• Helps in decision-making, understanding complex situations, and building knowledge.
• Turns raw data into insights that answer specific questions or meet particular needs.
• Transforms "just the facts" into "what does this mean?"
Examples of Information:
1. Reports:
o Combines various data (e.g., sales, expenses) to give a clear view of a situation, like a
company's financial health.
2. Summaries:
o Condenses large documents or reports into key points, making them easy to understand
at a glance, like an executive summary.
3. Visualizations:
o Converts data into charts, graphs, or other visuals to show trends and patterns, making
complex data easier to interpret and follow.
35 | P a g e
Data Vs Information:
Data Information
Data is raw and without organized We organise information into a useful format that
aids decision-making.
Data typically includes numbers, figures, Information typically includes language, words,
graphs, statistics or numerate symbols ideas, images or thoughts
People cannot make decisions based on data Can make good decisions using relevant, quality
alone information.
36 | P a g e
The four levels of the DIKW pyramid are:
1. Data: This is the raw, unprocessed facts and figures that are collected from various sources. Data
can be structured or unstructured and may include text, numbers, images, audio, and video.
2. Information: Data becomes information when it is organized, processed, and interpreted in a
meaningful way. The information provides context and relevance to data and enables decision-
making and action.
3. Knowledge: Knowledge is the understanding gained from information, through analysis,
interpretation, and synthesis. Knowledge is often based on experience, expertise, and intuition,
and enables more complex decision-making and problem-solving.
4. Wisdom: Wisdom is the highest level of the DIKW pyramid, representing the ability to apply
knowledge and experience to make sound judgments and decisions. Wisdom requires reflection,
insight, and foresight, and is often based on a deep understanding of the broader context and
implications of decisions.
Example:
1. Training AI Models: AI algorithms, particularly those based on machine learning and deep learning,
learn from data. These algorithms analyse and learn patterns, trends, and relationships within the
data to make predictions, classify information, or perform tasks.
2. Quality of Data: The quality of the data used to train AI models significantly impacts their
performance and accuracy. High-quality, relevant, and clean data is essential for producing reliable
AI systems. Conversely, poor-quality or biased data can lead to biased or inaccurate AI outcomes.
3. Quantity of Data: In many cases, more data leads to better AI performance. Larger datasets provide
AI models with more examples to learn from, enabling them to generalize better and make more
accurate predictions or decisions when faced with new, unseen data.
4. Data Labeling and Annotation: In supervised learning, where AI models are trained on labeled data,
data labeling and annotation are crucial processes. This involves manually labeling data samples
with corresponding categories or tags, providing the ground truth for training the AI model.
5. Data Preprocessing: Before training AI models, data often needs to be preprocessed. This includes
tasks such as cleaning the data, handling missing values, scaling or normalizing features, and
37 | P a g e
encoding categorical variables. Proper data preprocessing ensures that the data is in a suitable
format for training AI models.
6. Model Evaluation and Testing: Data is also used for evaluating and testing AI models. This involves
splitting the data into training and testing sets, or using techniques such as cross-validation, to
assess the model's performance on unseen data and ensure its generalization ability.
7. Iterative Improvement: AI models can be iteratively improved based on feedback from new data
and real-world performance. This process, known as continuous learning or model refinement,
allows AI systems to adapt and evolve over time as they encounter new data and experiences.
8. Ethical Considerations: Data plays a crucial role in addressing ethical considerations in AI. Ensuring
the fairness, transparency, and accountability of AI systems often requires careful consideration of
the data used to train them, as well as the potential biases or implications of AI outcomes.
Digital Footprints:
• A data footprint refers to the total amount of data that is created, stored, transferred, and utilized
by individuals, organizations, or systems over time.
• Whenever you use the internet, you leave behind a trail of information known as your digital
footprint. A digital footprint grows in many ways – for example, posting on social media, subscribing
to a newsletter, leaving an online review, or shopping online.
• Sometimes, it’s not always obvious that you are contributing to your digital footprint. For example,
websites can track your activity by installing cookies on your device, and apps can collate your data
without you knowing it.
• Once you allow an organization to access your information, they could sell or share your data with
third parties. Worse still, your personal information could be compromised as part of a data breach.
An active digital footprint is where the user has deliberately shared information about
themselves – for example, through posting or participating on social networking sites or online
forums. If a user is logged into a website through a registered username or profile, any posts they
make form part of their active digital footprint. Other activities that contribute to active digital
footprints include completing an online form – such as subscribing to a newsletter – or agreeing
to accept cookies on your browser.
A passive digital footprint is created when information is collected about the user without them
being aware that this is happening. For example, this occurs when websites collect information
about how many times users visit, where they come from, and their IP address. This is a hidden
process, which users may not realize is taking place. Other examples of passive footprints include
social networking sites and advertisers using your likes, shares, and comments to profile you and
target you with specific content.
38 | P a g e
Data Loss and Prevention:
Data loss refers to the unintended or accidental loss of data, which can occur due to a variety of reasons.
This data can be lost from various storage mediums, such as hard drives, SSDs, USB drives, or cloud
storage.
39 | P a g e
To minimize the risk of data loss, several best practices can be followed:
Antivirus Regular
Protection Backups
Use of Uninterrupted
reliable Power
hardware Supply
Safe Data
Practices recovery
tools
Data Recovery:
Data recovery is the process of retrieving lost, inaccessible, corrupted, damaged, or formatted data from
storage devices such as hard drives, solid-state drives (SSDs), USB flash drives, CDs, DVDs, and other
electronic devices. The methods used for data recovery can vary based on the cause and extent of the
data loss.
40 | P a g e
1. Software-Based Recovery
• File Recovery Programs: These programs scan the storage device for recoverable data. Examples
include Recuva, EaseUS Data Recovery Wizard, and Disk Drill.
• System Restore and Backup: If system restore points or backups are available, they can be used
to recover lost data.
2. Hardware-Based Recovery
• Replacing Components: For drives with physical damage, replacing faulty components (such as
circuit boards or read/write heads) might be necessary.
• Professional Services: Specialized data recovery services use cleanroom environments to open
and repair damaged drives, extracting data directly from the platters.
3. Manual Methods
• Disk Cloning: Creating a sector-by-sector clone of a damaged drive can allow attempts at
recovery without risking further data loss on the original drive.
• Command Line Tools: Utilities like chkdsk (Windows) or fsck (Linux) can repair logical errors in
file systems, sometimes restoring access to lost data.
Data Privacy:
Data privacy, also known as information privacy, refers to the practice of managing and safeguarding
personal or sensitive information to ensure that it is not accessed, shared, or used by unauthorized
parties. It encompasses the rights and expectations of individuals regarding the collection, storage,
processing, and sharing of their personal data. Data privacy is crucial in protecting individuals from
identity theft, financial fraud, and other forms of misuse of their information.
• Protecting Personal Information: Ensuring data privacy helps protect individuals from identity
theft, financial fraud, and other forms of exploitation or harm.
• Building Trust: Organizations that prioritize data privacy build trust with their customers, clients,
and partners.
• Legal Compliance: Adhering to data privacy laws is mandatory, and non-compliance can result in
severe penalties and reputational damage.
Data Visualization:
Data visualization is the graphical representation of information and data. By using visual elements like
charts, graphs, and maps, data visualization tools provide an accessible way to see and understand
trends, outliers, and patterns in data.
41 | P a g e
Data visualization is a powerful tool that turns raw data into a story, allowing users to see patterns,
trends, and actionable insights. Whether in business, science, or education, it simplifies data
interpretation and helps make informed decisions.
42 | P a g e
Maps Infographics Dashboards
Represents data on Infographics Combine multiple
geographical maps. combine text, visualization to
Displaying images, and graphics provide a
population density, intending to present comprehensive view
weather data or information in a way of related data.
election results. that is easy to Business intelligence
understand and dashboards for
visually appealing. tracking KPIs
Line Graph:
• A graph that uses lines to connect individual data points.
• A line graph—also known as a line plot or a line chart—is a graph that uses lines to connect individual
data points. A line graph displays quantitative values over a specified time interval.
• Line graphs consist of two axes: x-axis (horizontal) and y-axis (vertical), graphically denoted as (x,y).
43 | P a g e
• In investing, in the field of technical analysis, line graphs are quite informative in allowing the user
to visualize trends.
• While line graphs are used across many different fields for different purposes, their most common
function is to create a graphical depiction of changes in values over time.
• In finance, line graphs are used to create visual representations of values over time, including
changes in the prices of securities.
• It is beneficial for showing changes and trends over different time periods.
• It is also helpful to show small changes that are difficult to measure in other graphs.
• Line graph is common and effective charts because they are simple, easy to understand, and
efficient.
• More than one line may be plotted on the same axis as a form of comparison.
3. Draw and label the scale on the vertical (y-axis) and horizontal (x-axis) axes.
44 | P a g e
Bar Graphs:
• A bar graph can be defined as a graphical representation of data, quantities, or numbers using
bars or strips. They are used to compare and contrast different types of data, frequencies, or
other measures of distinct categories of data.
• The gap between one bar and another should be uniform throughout.
• Bars may be shared with colors or pattern to make them distinct and attractive.
45 | P a g e
• Show each data category in a frequency distribution.
• Example: From the given graph, we can easily say that orange is the most bought fruit.
Pie Chart:
• A pie chart is a graphical representation technique that displays data in a circular-shaped graph.
• Pie charts are often used to represent sample data—with data points belonging to a combination
of different categories.
• The size of each slice is directly proportional to the number of data points that belong to a
particular category.
• Example: The given pie chart represents sales data, where 43 percent of sales were from
furniture, 28 percent from electronics, 15 percent from toys, and 14 percent from home decor.
These figures add up to 100 percent, as should always be the case with pie graphs.
46 | P a g e
Example of Pie Chart:
Construct a pie chart to visually display the favorite fruits of the students in a class based on the given
data: Mango - 45; Orange - 30; Plum - 15; Pineapple - 30; Melon - 30
Solution:
Step 1: Create a table with the values and get the total.
Step 3: Finding the degree of each pie sector using the formula: (Given data/Total Value of data) × 360°
With all the above degrees, with the help of a protractor draw a pie chart.
47 | P a g e
Mango 45
Orange 30
Plum 15
Pineapple 30
Melon 30
Total 150
Scatter Graph:
• A scatter plot is also called a scatter chart, scattergram, or scatter plot, XY graph.
• The scatter diagram graphs numerical data pairs, with one variable on each axis, show their
relationship.
• The following scatter plot excel data for age (of the child in years) and height (of the child in feet)
can be represented as a scatter plot.
48 | P a g e
Age of the Child Height
3 2.3
4 2.7
5 3.1
6 3.6
7 3.8
8 4
9 4.3
10 4.5
Identification:
• Tasks: Understand the data structure, format, and identify potential issues or limitations.
• Actions: Search databases, contact data providers, and gather data from various sources, both
internal and external.
Acquiring:
• Tasks: Obtain data through downloading, scraping, or receiving files, and ensure compliance with
legal and ethical standards.
• Methods:
49 | P a g e
Exploring:
• Actions:
EXERCISE
A. MULTIPLE CHOICE QUESTIONS
(a) The data trail left by you when you surf the internet
2. What is the main difference between Information and data in the DIKW model?
(c) Information has meaning and context, while data does not.
(d) Information is only used by humans, while data can be used by machines.
50 | P a g e
4. What is the purpose of transforming data into information?
(a) To make the data easier to store. (b) To make the data easier to analyze.
(c) To give the data meaning and context. (d) To make the data more valuable.
(c) The number of items sold in a day. (d) The customer's opinion of a product.
(a) A set of regulations that govern the collection and use of personal data in the European Union.
10. You regret posting a particular picture and want to take it down. Is it possible, and how would you
do that?
(a) It is a little tricky but can be done by asking a professional to do it. Then no one can see the photo.
(b) You can delete the picture by clicking on the delete button. Then no one can see the photo anymore
(d) A photo can be deleted from your account, but someone might have already saved it or copied it.
51 | P a g e
B. STATE TRUE/FALSE
4. Websites and mobile apps use our search history to provide personalized offers.
5. Wisdom is the highest level of the DIKW model, representing the ability to make ethical and moral
decisions based on a deep understanding of knowledge and experience.
6. Data privacy laws vary by country and can have different requirements for businesses and
organizations.
7. Data loss can occur due to hardware failure, human error, or malicious attacks.
9. Bar charts and pie charts are the only types of data visualization tools available.
10.Individuals have no control over the personal information that companies collect about them
3. What are the main causes of data loss, and what steps can Individuals and organizations take to
prevent data loss Incidents?
4. What are data footprints? What are the different types of data footprints?
5. Describe the stages of the DIKW model, and provide an example of how data can be transformed
through each stage to create knowledge.
7. What are the privacy risks associated with social media use, and what steps can individuals take to
protect their personal information on social media platforms?
9.What is personal data, and how can you keep your data safe online?
52 | P a g e
D. ASSESSMENT
1. Students can construct a data backup plan for a fictitious company or organization in this activity by
working in teams. They must decide how frequently backups should be made, what kinds of data need
to be backed up, and which backup techniques to use. Students will gain a better understanding of the
value of data backup plans and the different backup options available through this activity.
2. Collect data of 50 vehicles possessed by your classmates. You can record the number of wheels, the
color of the vehicle and try to present the data as a dot plot. Compare the plots with your classmates.
Find the color of the vehicle, which is most common, and the least common vehicle has how many
wheels. Use a chart to represent the data.
3. Divide the class into two groups and conduct a debate on the topic.
E. KNOWLEDGE HUB
https://www.ibm.com/in-en/topics/data-recovery
F. EXPERIENTIAL LEARNING
https://youtu.be/UFp3wYV1-3M
53 | P a g e
Module 3: Evolution of Computing
Boolean logic is a type of algebra in which results are calculated as either TRUE or FALSE (known as truth
values or truth variables). In Boolean logic, the basic values are:
The logic and mathematics of this system were developed mainly by the British mathematician George
Boole (1815–64), whose contributions were so important that the concept is often referred to
as Boolean algebra.
Boolean logic only works when an expression can be TRUE or FALSE. For example, the expression 3 + 8
isn’t a Boolean expression because it’s not being compared or related to something else. But the
expression 3 + 8 = 10 is a Boolean expression because we can now evaluate each side and see if the
reported relationship between them is TRUE or FALSE (in this case, it’s FALSE).
1. Boolean Variable: A Boolean variable has only two possible values: true or false. One bit represents
one Boolean variable. In electric circuit if the signal passes, it represents 1, else it is represented as 0.
2. Boolean Constant: Boolean constant is a fixed value in a program that can only take on one of two
possible values: "true" or "false", yes/no, 1/0.. Boolean constants are often used to represent logical
values, such as the result of a comparison or a condition that is always true or false.
5. Boolean Operators: Instead of using arithmetic operators like addition, subtraction, and
multiplication, Boolean logic utilizes three basic logical operators: AND, OR, and NOT.
54 | P a g e
This operator returns true if all relational statements combined
&& (Logical AND)
with && are true, else it returns false.
This operator returns true if at least one of the relational
|| (Logical OR)
statements combined with || is true, else it returns false.
! (logical NOT) It returns the inverse of the statement's result.
Truth Table:
• A truth table is a tabular representation of all the combinations of values for inputs and their
corresponding outputs.
• Truth tables are used in Boolean algebra and in other areas of mathematics and science that rely on
Boolean logic to show the possible outcomes of an expression or operation in terms of its truth or
falseness.
• Identify the variables: Each variable in the propositional statement needs to be identified and
assigned a column in the truth table.
• Determine the number of rows: The number of rows in the truth table is determined by the number
of variables. For example, if there are two variables, there will be four rows.
• Assign truth values: For each variable, assign either a truth value of "true" or "false" in each row of
the truth table.
• Construct the columns for the logical operators: If the propositional statement contains logical
operators such as "and", "or", "not", etc., additional columns will need to be added to the truth table
for each operator.
• Apply the logical operators: Using the truth values assigned to each variable and the logical
operators, determine the truth value of the entire propositional statement in each row of the truth
table.
• Complete the truth table: Once all the truth values have been determined, fill in the final column
with the truth values of the entire propositional statement.
• Verify the final column: Check that the final column of the truth table matches the truth values of
the entire propositional statement. If they match, the truth table is correct.
AND (∧): The result is true if and only if all inputs are true.
A B A∧B
T T T
T F F
F T F
F F F
55 | P a g e
OR (∨): The result is true if at least one input is true.
A B A∨B
T T T
T F T
F T T
F F F
A ¬A
T F
F T
Logic Gates:
• Logic gates are the fundamental components of all digital circuits and systems.
• In digital electronics, there are seven main types of logic gates used to perform various logical
operations.
• A logic gate is basically an electronic circuit designed by using components like diodes, transistors,
resistors, capacitors, etc., and capable of performing logical operations.
• As the name implies, a logic gate is designed to perform logical operations in digital systems like
computers, communication systems, etc.
• A logic gate can take two or more inputs but only produce one output. The output of a logic gate
depends on the combination of inputs and the logical operation that the logic gate performs.
56 | P a g e
AND Gate
The AND gate is a digital logic gate with ‘n’ i/ps one o/p, which performs logical conjunction based on
the combinations of its inputs. The output of this gate is true only when all the inputs are true. When
one or more inputs of the AND gate’s i/ps are false, then only the output of the AND gate is false. The
symbol and truth table of an AND gate with two inputs is shown below.
OR Gate
The OR gate is a digital logic gate with ‘n’ i/ps and one o/p, that performs logical conjunction based on
the combinations of its inputs. The output of the OR gate is true only when one or more inputs are true.
If all the i/ps of the gate are false, then only the output of the OR gate is false. The symbol and truth
table of an OR gate with two inputs is shown below.
NOT Gate
The NOT gate is a digital logic gate with one input and one output that operates an inverter operation
of the input. The output of the NOT gate is the reverse of the input. When the input of the NOT gate is
true then the output will be false and vice versa. The symbol and truth table of a NOT gate with one
input is shown below. By using this gate, we can implement NOR and NAND gates.
57 | P a g e
NAND Gate
The NAND gate is a digital logic gate with ‘n’ i/ps and one o/p, that performs the operation of the AND
gate followed by the operation of the NOT gate. NAND gate is designed by combining the AND and NOT
gates. If the input of the NAND gate high, then the output of the gate will be low. The symbol and truth
table of the NAND gate with two inputs is shown below.
NOR Gate
The NOR gate is a digital logic gate with n inputs and one output, that performs the operation of the OR
gate followed by the NOT gate. NOR gate is designed by combining the OR and NOT gate. When any one
of the i/ps of the NOR gate is true, then the output of the NOR gate will be false. The symbol and truth
table of the NOR gate with the truth table is shown below.
Exclusive-OR Gate
The Exclusive-OR gate is a digital logic gate with two inputs and one output. The short form of this gate
is Ex-OR. It performs based on the operation of the OR gate. If any one of the inputs of this gate is high,
then the output of the EX-OR gate will be high. The symbol and truth table of the EX-OR are shown
below.
58 | P a g e
Deterministic Computing:
• In deterministic computing, a given input always produces the same output under the same
conditions.
• The behavior of deterministic systems is entirely predictable and repeatable, making them suitable
for tasks that require consistency and precision.
Characteristics:
• Predictability: For any specific input, the output is always the same.
• Reproducibility: Given the same initial state and input, the computation will always proceed in the
same way.
• Applications: Critical systems where predictability is essential, such as in financial systems, safety-
critical systems (e.g., aviation software), and most traditional computing tasks.
Facilitates testing, debugging, and Not well-suited for problems with inherent
Reproducibility
verification randomness
Consistent and expected behavior May not handle dynamic or adaptive threats
Security
reduces risks as effectively
Works well for small to moderate- Performance may degrade with increased
Scalability
sized problems complexity
59 | P a g e
Example of deterministic computing:
1. Calculating the area of a square: Use the formula A=s2A = s^2A=s2 where sss is the side length.
2. Determining the shortest path between two points on a map: Use algorithms like Dijkstra's or A* (A-
star) algorithm.
3. Computing payroll for employees: Use inputs such as hourly rate, hours worked, and deductions to
determine net pay.
4. Calculating the trajectory of a projectile: Use initial velocity and angle with Newton's equations of
motion.
6. Simple Mathematical Equations: Operations like addition (2+2), subtraction, multiplication, and
division are deterministic.
8. Motion of Objects: Predict using laws of physics (e.g., ball rolling down a hill).
10. Production Processes: Predict outcomes of each step assuming proper equipment and materials.
Probabilistic Computing:
• In probabilistic computing, the output is not guaranteed to be the same every time even if the input
is unchanged. This approach often leverages randomness or probabilistic processes to solve
problems, which can be especially useful in situations where deterministic methods are too slow or
complex.
Characteristics:
• Unpredictability: The same input can produce different outputs on different runs.
• Efficiency in Complex Problems: Often used for problems where deterministic solutions are
infeasible due to high complexity.
• Probabilistic Algorithms: Algorithms that use randomization or probability to produce a result, such
as Monte Carlo methods, genetic algorithms, and randomized algorithms.
• Applications: Fields like machine learning, cryptography, optimization problems, and scenarios where
approximate solutions are acceptable or even preferred.
60 | P a g e
Aspect Advantage Disadvantage
Efficiency Faster and more scalable for complex Potential computational overhead due
problems to randomness
Exploration Diverse and novel solutions Results are inconsistent and sometimes
non-reproducible
Scalability Scales well with large datasets and Complex to design and implement
parallel computing
Applications in AI Effective for AI, ML, and decision- Interpretation and understanding of
making under risk results can be challenging
Predictability Adapts to changing conditions and new Lack of predictability and reproducibility
information
Accuracy Good for approximate solutions where Not suitable for precision-critical tasks
exact answers are not critical
1. Weather forecasting: Involves predicting the likelihood of different weather conditions using past
data, current conditions, and various models.
2. Stock market prediction: Involves estimating probabilities and risks based on economic indicators,
company performance, and global events.
3. Medical diagnosis: Involves assessing the likelihood of different diseases based on symptoms,
medical history, and test results.
4. Traffic flow prediction: Involves estimating the likelihood of congestion and delays based on factors
like time of day, weather, and accident history.
5. Insurance risk assessment: Involves analyzing data such as age, health, and driving history to estimate
the likelihood of future events like accidents or illnesses.
6. Risk assessment: Involves analyzing the likelihood and impact of different risks, such as natural
disasters or accidents, using statistical models.
7. Quality control: Involves analyzing the likelihood of defects in a product or process using statistical
models to improve product quality.
61 | P a g e
EXERCISE
A. MULTIPLE CHOICE QUESTIONS
(c) A problem where the outcome depends on a combination of random and predictable factors
(d) A problem where the outcome depends on the personal opinion of the observer
(c) Solving a system of linear equations (d) Selecting a card from a deck of cards
(b) There are multiple possible solutions, but the outcome is still predictable
(c) A problem where the outcome depends on a combination of random and predictable factors
(d) A problem where the outcome depends on the personal opinion of the observer
62 | P a g e
7. Which of the following is an example of a probabilistic problem?
(a) Solving a system of linear equations (b) Selecting a card from a deck of cards
(b) There are multiple possible solutions, but the outcome is still predictable
(c) Solving a Sudoku puzzle (d) Choosing a random number between 1 and 10
11. What is the output of a NAND gate if both inputs are true?
12. What is the output of a NOR gate if one input is true and the other input is false?
63 | P a g e
15. Which of the following is a unary Boolean operator?
1. What is the difference between deterministic and probabilistic computing, and what are some real-
world applications of each?
2. Define
• Boolean Variable
• Boolean Statements
• Boolean Constant
• Truth Table
• Logic Gates
C. KNOWLEDGE HUB
https://ecomputernotes.com/mis/information-and-system-concepts/differentiate-between-
deterministic-and-probabilistic-systems
D. EXPERIENTIAL LEARNING
https://youtu.be/vJO-5gY0wpk
64 | P a g e
Module 4: Introduction to Python
Python, first created in 1980s by the Guido van Rossum, is one of the most popular programming
languages. During his research at the National Research Institute for Mathematics and Computer
Science in the Netherlands, he created Python – a super easy programming language in terms of
reading and usage. The first ever version was released in the year 1991 which had only a few built-in
data types and basic functionality.
Features/Advantages of Python:
65 | P a g e
• Easy-to-learn − Python has few keywords, simple structure, and a clearly defined syntax. This
allows the student to pick up the language quickly.
• Easy-to-read − Python code is more clearly defined.
• A broad standard library − Python's bulk of the library is very portable and cross-platform
compatible on UNIX, Windows, and Macintosh.
• Memory Management – Python’s automatic memory management frees us from having to
manually allocate and free memory in our code.
• Interactive Mode − Python has support for an interactive mode which allows interactive testing
and debugging of snippets of code.
• Portable − Python can run on a wide variety of hardware platforms and has the same interface
on all platforms.
• Open-source - Python is free and open-source, and anyone can use it. You can download and
install Python for free from python.org.
History of Python:
• Developed in February 1991 at the National Research Institute for Mathematics and Computer
Science in the Netherlands by Guido Van Rossum.
• Python was conceived in the late 1980's its implementation was started in December 1990.
• Guido Van Rossum is a fan of BBC Comedy show “Monty python's flying circus, a famous TV series.
66 | P a g e
Application of Python:
Python is a versatile programming language with a wide range of applications across various domains.
Here are some common applications of Python:
1. Web Development: Python is popular for building websites and web applications.
Frameworks like Django and Flask make it easy to develop powerful and scalable web
applications.
2. Data Science and Machine Learning: Python has become the de facto language for data
science and machine learning projects. Libraries like NumPy, pandas, scikit -learn, and
TensorFlow provide robust tools for data analysis, modeling, and deep learning.
3. Scripting: Python is often used for writing scripts to automate repetitive tasks, such as file
4. Desktop GUI Applications: Python offers GUI (Graphical User Interface) libraries like
Tkinter and PyQt for developing desktop applications with a graphical interface.
5. Game Development: Python, along with libraries like Pygame, is used for creating simple
6. Networking: Python is used for network programming tasks such as socket programming,
7. Prototyping: Due to its easy syntax and readability, Python is often used for prototyping
concepts to beginners. Many educational institutions use Python as the primary language
for teaching programming. Python developers highly value its flexibility and ease of use.
67 | P a g e
Top Companies using Python:
We will be using IDLE(Integrated Development and Learning Environment) for writing and executing
python Codes.
• Python shell window (interactive interpreter) with colorizing of code input, output, and error
messages
• multi-window text editor with multiple undo, Python colorizing, smart indent, call tips, auto
completion, and other features
• search within any window, replace within editor windows, and search through multiple files
(grep)
• debugger with persistent breakpoints, stepping, and viewing of global and local namespaces
68 | P a g e
Modes of Interaction:
Python programming language, there are two ways in which we can run our code:
1. Interactive Mode
in Python, Interactive Mode in Python provides a dynamic environment for developers to interactively
write and execute Python statements line by line. It offers a way to experiment, test code snippets, and
receive immediate feedback for each command entered. Unlike Script Mode, which involves creating
separate script files, Interactive Mode allows developers to input code directly and observe the results
in real-time.
• Interactive Mode provides an immediate feedback loop, allowing developers to test code snippets
and see results instantly. This facilitates rapid experimentation and learning.
• Beginners find Interactive Mode valuable as they can interactively try out Python syntax and
concepts. This hands-on approach aids in grasping programming fundamentals effectively.
• Small code fragments can be tested promptly in Interactive Mode without creating separate script
files. This makes it ideal for testing isolated code components.
• Developers can explore and understand Python's various features, functions, and libraries on the fly.
This helps in learning how to utilize Python's capabilities efficiently.
69 | P a g e
• Identifying errors and debugging is simplified as developers can observe the output of each
statement immediately after execution, helping pinpoint issues swiftly.
2. Script Mode
Among interactive mode and script mode in Python, Script Mode in Python refers to writing and
executing Python scripts or programs. It involves creating a standalone Python script file with a series of
Python statements saved with the .py extension. These scripts can range from simple tasks to complex
applications and are executed using a Python interpreter. Script Mode provides a structured and
organized way of programming, making it suitable for projects that involve multiple lines of code.
Using Script Mode
a. Creating a Script:
To use Script Mode, you create a new text file using a code or plain text editor. You write your Python
code within this file, including imports, functions, and other statements.
70 | P a g e
c. Executing the Script:
To run the script, you open a terminal or command prompt, navigate to the directory where the script
is saved, and use the python command followed by the script's filename. The Python interpreter
reads and executes the script from top to bottom.
• Script mode of execution is very much suitable for us to write long Python programs (programs
having more than a single code line).
• We can easily do the editing of our Python program inside the script mode.
• We can open our Python program as many times as we want inside the script mode.
• In script mode, we can even save the code we have written to use in the future.
• Script mode is execution is mostly preferred by all the experts and Python programmers.
Print statements:
Example:
print(“Hello world”) #This prints the string “Hello world”
71 | P a g e
EXERCISE
A. FILL IN THE BLANKS
1. Python was created by __________ at the National Research Institute for Mathematics and
Computer Science in the Netherlands.
2. In Python, __________ mode allows for testing and debugging of code snippets instantly.
3. Python is an __________ programming language, meaning it uses objects to represent data and
methods.
4. First version of python was released in the year ___________.
1. In which mode we can write programs with multiple lines and then test them out?
(a) Script (b) Idle
(c) Interactive (d) CLI
72 | P a g e
C. ANSWER THE FOLLOWING
1. Who developed the Python Programming language? Which is the show on which the language is
based?
2. What is the difference between interactive mode and script mode in Python?
3. Which are the applications of Python?
4. Write any four features of Python.
5.Why is Python considered a high-level language?
6.What makes Python suitable for beginners?
7.What does the Python IDLE shell window allow users to do?
D. ASSESSMENT
Toonify is a set of Al powered tools for face transformation. Upload a photo and see what you'd look like
in your own animated movie. Start Toonifying!
Visit https://toonify.photos/
E. KNOWLEDGE HUB
https://realpython.com/python-idle/
https://www.w3schools.com/python/python_intro.asp
https://www.coursera.org/in/articles/what-is-python-used-for-a-beginners-guide-to-using-python
F. EXPERIENTIAL LEARNING
https://www.youtube.com/watch?v=Y8Tko2YC5hA
https://youtu.be/WIlQukiXs-E
73 | P a g e
Module 5: Datatypes and Variables
• Alphabets: These include all the small (a-z) and capital (A-Z) alphabets.
• Digits: It includes all the single digits 0-9.
• Special Symbols: It includes all the types of special characters," 'l ; : ! ~ @ # $ % ^ ` & * ( ) _ + - = { } [ ]
\.
• White Spaces: White spaces are also a part of the character set. These are tab space, newline, blank
space, and carriage return.
• Other: Python supports all the types of ASCII and UNICODE characters that constitute the Python
character set.
74 | P a g e
Identifiers:
The names assigned to any variable, class, function, list, method, etc., for their recognition are known as
identifiers. Python has certain guidelines for naming identifiers and is a case-sensitive programming
language.
• Python is case-sensitive, as was already mentioned. So, when defining identifiers, the case is
important. Thus, the terms "python" and "Python" are not interchangeable.
• A capital alphabet (A-Z), a small alphabet (a-z), or an underscore (_) precedes the word "identifier."
No other character can be used as the starting point.
• Digits are also allowed to be a member of the identifier, along with the letters and underscores, but
they cannot be the initial character.
• Any additional special symbols or whitespace must be avoided when creating an identity.
• A keyword cannot be an identifier.
• age=18
Identifiers • City=Mumbai
• name=Yatra
Variables
Variables are, the containers of data which can vary during the execution of program.
# An integer assignment
age = 45
# A floating point
salary = 1456.8
# A string
name = "John"
75 | P a g e
Naming Variables:
76 | P a g e
Keywords:
Python Keywords are some predefined and reserved words in Python that have special meanings.
Keywords are used to define the syntax of the coding. The keyword cannot be used as an identifier,
function, or variable name. All the keywords in Python are written in lowercase except True and False.
Statements:
A statement in Python is a line of code that instructs the Python interpreter to perform a specific
action. Statements are the core of Python programming, and there are many different types of
statements in Python.
Print statements:
Print is a function which can display strings, integer or any other datatypes.
Example:
print(“Hello world”) #This prints the string “Hello world”
77 | P a g e
Expression:
A combination of operands and operators is called an expression. The expression in Python produces
some value or result after being interpreted by the Python interpreter.
An example of expression can be : x=x+10x=x+10.
In this expression, the first 1010 is added to the variable x. After the addition is performed, the result is
assigned to the variable x.
Expression Vs Statement:
Expression Statement
Example: Example:
Comments:
Comments in Python are the lines in the code that are ignored
by the interpreter during the execution of the program.
Comments enhance the readability of the code and help the
programmers to understand the code very carefully.
Single-Line Comments:
• Python single-line comment starts with the hashtag symbol (#) with no white spaces and lasts till
the end of the line.
• If the comment exceeds one line then put a hashtag on the next line and continue the Python
Comment.
• Python’s single-line comments are proved useful for supplying short explanations for variables,
function declarations, and expressions.
• Example: print("Hello, World!") #This is a comment
78 | P a g e
Multiple line comment:
#This is a comment
#written in
#more than just one line
print("Hello, World!")
Or
Since Python will ignore string literals that are not assigned to a variable, you can add a multiline string
(triple quotes) in your code, and place your comment inside it:
Example:
"""
This is a comment
written in
more than just one line
"""
print("Hello, World!")
Indentation:
Indentation in Python refers to the whitespaces at the start of the line to indicate a block of code. We
can create an indentation using space or tabs. When writing Python code, we have to define a group of
statements for functions and loops. This is done by properly indenting the statements for that block.
The leading whitespaces (space and tabs) at the start of a line are used to determine the indentation
level of the line. We have to increase the indent level to group the statements for that code block.
Similarly, reduce the indentation to close the grouping.
Let’s look at an example to understand the code indentation and grouping of statements.
def foo():
print("Hi")
if True:
print("true")
else:
print("false")
print("Done")
79 | P a g e
The rules that one should follow while using indentation:
• The first line of Python code can’t have an indentation, it will throw Indentation Error.
• You should avoid mixing tabs and whitespaces to create an indentation. It’s because text editors in
Non-Unix systems behave differently and mixing them can cause the wrong indentation.
• It is preferred to use whitespace than the tab character.
• The best practice is to use 4 whitespaces for the first indentation and then keep adding additional 4
whitespaces to increase the indentation.
Data Types:
Python data types are actually classes, and the defined variables are their instances or objects. Since
Python is dynamically typed, the data type of a variable is determined at runtime based on the assigned
value.
In general, the data types are used to define the type of a variable. It represents the type of data we are
going to store in a variable and determines what operations can be done on it.
80 | P a g e
In python the type of a variable can be found by the statement:
type(variable name)
Example:
x = 10
print("x is of type:",type(x))
y = 10.6
print("y is of type:",type(y))
z=x+y
print(z)
print("z is of type:",type(z))
As we can see the data type of ‘z’ got automatically changed to the “float” type while one variable x is
of integer type while the other variable y is of float type. The reason for the float value not being
converted into an integer instead is due to type promotion that allows performing operations by
81 | P a g e
converting data into a wider-sized data type without any loss of information. This is a simple case of
Implicit type conversion in Python.
# initializing string
s = "10010"
Variables are declared automatically when they are assigned value. There is no need to declaring
variable explicitly as python is a loosely typed language. The assignment operator (=) is used to
assign a value to a variable.
User Input:
Input () : The input function in Python is used to take input from the users, and, by default, it returns the
user input in the form of a string.
Example 1:
name=input(“Enter your name”) “““Displays the message Enter your name and waits for the input
from the user”””
Example 2:
In this example, we are using the Python input() function which takes input from the user
in string format converting it into an integer adding 1 to the integer, and printing it.
82 | P a g e
# Taking input from the user as integer
num = int(input("Enter a number:"))
add = num + 1
User Output:
Once a program accepts input in Python and processes the data, it needs to present the data back to the
user as output. We use the print() function to display the output data to the console (screen).
print() : The print() function is used to print the desired message on a device’s screen. The print is always
in a string format. If the print message is in other objects, it is first converted into a string before being
printed. You can input single or multiple objects of any type. Before being printed the objects gets
converted to a string
Example:
name = "Alice"
age = 30
print("Name:", name, "Age:", age)
Concatenation:
The process of combining strings is called as concatenation.
Example: It’s very easy to use the + operator for string concatenation. This operator can be used to
add multiple strings together.
a=input("Enter a:")
b=input("Enter b:")
print(a+ “ “ +b)
EXERCISE
A. MULTIPLE CHOICE QUESTIONS
(a) in (b) it
2. What is the word (command) used to display numbers and text on the screen?
83 | P a g e
3. What is a variable?
(a) A box(memory location) where you store values (b) a type of graphics
name= "Python”
print (name)
(a) 20 (b) 26
(a) A function that allows us to ask the user to enter some data.
(a) @ (b) #
84 | P a g e
11. A _________ expression is an expression that is either true or false.
12. All keywords in Python except True, False and None are in ____________.
1. "Comments are useful and an easy way to enhance readability and understandability of a program".
Elaborate with examples.
4. Define a data type. List the five standard data types in Python.
5. What is type casting? Write the names of two types of conversion methods & give an example each.
6. Differentiate between
7. Define identifiers. Identify the valid and Invalid Identifiers in the following list.
1. a=1
a, b = a+1, a+1
print(a,b)
2.xy = 7, 2
x, y, x = x + 1, y + 3, x + 10
print(x,y)
3. x, y = 2, 6
x, y = y,x + 2
print (x, y)
85 | P a g e
4. x = 40
y=x+1
x = 20, y + x
print(x,y)
5.x, y = 20, 60
у,х, у=х, у-10, x+10
print (x,y)
D. KNOWLEDGE HUB
https://data-flair.training/blogs/python-variables-and-data-types/
G. EXPERIENTIAL LEARNING
https://youtu.be/6yrsX752CWk
86 | P a g e
Module 6: Operators in python
Operators:
Operators refer to special symbols that perform operations on values and variables. These are standard
symbols used for logical and arithmetic operations.
Arithmetic Operators:
Arithmetic operators are used with numeric value to perform basic mathematical operations
like addition, subtraction, multiplication, and division.
Operator Associativity
() Left to Right
** Right to Left
+x and -x Left to Right
*, / , // and % Left to Right
+ and - Left to Right
Relational Operators:
Relational operators are used to: Make decisions in a program, Control program flow, and Filter
data. The relational operators are also known as Comparison Operators.
The Relational operators in Python return a boolean value i.e., either True or False, based on the value
of operands.
87 | P a g e
Logical Operator:
A logical operator is a symbol or keyword that combines two or more expressions to produce a Boolean
outcome, either true or false.
88 | P a g e
Precedence of assignment Operators:
Membership Operators
The Python membership operators test for the membership of an object in a sequence, such as strings,
lists, or tuples. Python offers two membership operators to check or validate the membership of a
value.
They are as follows:
Membership
Description Syntax
Operator
list1 = [1, 2, 3, 4, 5]
str1 = "Hello World"
#checking an integer in a list
print(2 not in list1)
# checking a character in a string
print('O' not in str1)
Output:
False
True
89 | P a g e
Identity Operators
The Python Identity Operators are used to compare the objects if both the objects are actually of the
same data type and share the same memory location. There are different identity operators such as:
Identity
Description Syntax
Operator
Example is Operator:
num1 = 5
num2 = 5
lst1 = [1, 2, 3]
lst2 = [1, 2, 3]
str1 = "hello world"
str2 = "hello world"
# using 'is' identity operator on different datatypes
print(num1 is num2)
print(lst1 is lst2)
print(str1 is str2)
Output:
True
False
True
num1 = 5
num2 = 5
lst1 = [1, 2, 3]
lst2 = [1, 2, 3]
str1 = "hello world"
str2 = "hello world"
# using 'is not' identity operator on different datatypes
print(num1 is not num2)
print(lst1 is not lst2)
print(str1 is not str2)
90 | P a g e
Output:
False
True
False
EXERCISE
A. MULTIPLE CHOICE QUESTIONS
cool_variable_1 = 23.18
cool_variable_2 = 9
cool_variable_4 = 14** 3
print(message)
(a) Python throws a Syntax Error because the string is not surrounded by quotes.
(b) Python throws a NameError because the name is not defined properly.
91 | P a g e
5. __________allow you to put special characters into your code.
print("Hello world!" * 2)
8. Each item in a list has an "address" or index. The first index in a Python list is what?
(a) 0 (b) 1
(c) a (d) A
11. Choose the statement that assigns 4 to the power of 3 to the variable new_var.
(a) / (b) //
92 | P a g e
13. What is the answer to this expression, 22% 3 is?
(a) 7 (b) 1
(c) 0 (d) 5
14. Operators with the same precedence are evaluated in which manner?
(a) 27 (b) 9
(c) 3 (d) 1
(a) + (b) *
1. Write Python code to calculate and display the selling price of an item by Inputting the cost price and
profit.
2. Write Python code to accept the side of a square and print its area.
3. Write Python code to Input the temperature in Celsius and convert it into Fahrenheit using the formula
(F = C*9/5+32)
4. Write Python code that accepts marks in 5 subjects and outputs average marks.
5. Write python code to input a number and print its square and cube.
6. Write python code that takes the amount in dollars and the conversion rate of dollars to rupees price,
it then returns the amount converted to rupees.
93 | P a g e
D. SUBJECT ENRICHMENT
Watch the following video and read the article on ChatGPT and discuss it in class
https://youtu.be/fulZUadO4po
https://www.cnbc.com/2023/02/08/what-is-chatgpt-viral-al-chatbot-at-heart-of-microsoft-google-
fight.html
E. ASSESSMENT
1. Sound Canvas - A simple drawing tool that works through both sight and sound.
Visit https://creatability.withgoogle.com/sound-canvas/
F. KNOWLEDGE HUB
https://developers.google.com/edu/python/strings
G. EXPERIENTIAL LEARNING
https://youtu.be/E7gnrPinmSw
94 | P a g e
Module 7: Applications and benefits of AI
1. Commercial Sector:
• Customer Service: AI-powered chatbots and virtual assistants provide personalized customer
support and assistance, improving customer satisfaction and reducing response times.
• Sales and Marketing: AI algorithms analyze customer data to identify patterns, predict purchasing
behavior, and optimize marketing campaigns for targeted advertising and lead generation.
• Supply Chain Management: AI algorithms optimize inventory management, demand forecasting,
and logistics operations to streamline supply chain processes and reduce costs.
2. Industry:
• Manufacturing: AI-enabled robots and automation systems enhance efficiency and flexibility in
manufacturing processes, enabling tasks such as assembly, quality control, and predictive
maintenance.
• Predictive Maintenance: AI algorithms analyze sensor data to predict equipment failures and
schedule maintenance proactively, minimizing downtime and optimizing asset utilization.
• Quality Control: AI-based computer vision systems inspect products for defects, ensuring high-
quality standards in manufacturing operations.
3. Medical/Healthcare:
• Diagnosis and Treatment: AI algorithms analyze medical imaging data (e.g., X-rays, MRI scans) to
assist radiologists in diagnosing diseases such as cancer, fractures, and neurological disorders.
• Drug Discovery: AI accelerates the drug discovery process by analyzing molecular structures,
predicting drug interactions, and identifying potential candidates for new therapies.
• Personalized Medicine: AI algorithms analyze patient data to tailor treatment plans and predict
individual responses to medications, improving patient outcomes and reducing adverse effects.
4. Defense:
• Autonomous Systems: AI-powered drones and unmanned vehicles perform reconnaissance,
surveillance, and reconnaissance missions in military operations, reducing risks to human personnel.
• Cybersecurity: AI algorithms detect and respond to cybersecurity threats in real-time, identifying
anomalies, and mitigating cyberattacks to protect critical infrastructure and sensitive data.
5. Banking:
• Fraud Detection: AI algorithms analyze transaction data and user behavior to detect fraudulent
activities and prevent financial fraud in banking and online transactions.
• Risk Management: AI models assess credit risk, evaluate loan applications, and optimize investment
portfolios to support decision-making in banking and financial services.
95 | P a g e
6. Entertainment:
• Content Recommendation: AI algorithms personalize content recommendations for users on
streaming platforms, social media, and e-commerce websites, enhancing user engagement and
satisfaction.
• Content Creation: AI generates and curates content such as articles, music, and artwork, providing
creative insights and inspiration to artists and content creators.
7. Transportation:
• Autonomous Vehicles: AI enables self-driving cars and trucks to navigate roads safely, reducing
accidents, congestion, and emissions in transportation systems.
• Traffic Management: AI algorithms optimize traffic flow, analyze traffic patterns, and predict
congestion to improve efficiency and safety in urban transportation networks.
8. Security:
• Surveillance: AI-powered surveillance systems monitor and analyze video feeds from security
cameras, detecting suspicious activities, and identifying potential threats in public spaces, airports,
and critical infrastructure.
• Biometric Identification: AI-based biometric systems use facial recognition, fingerprint scanning,
and voice analysis to authenticate individuals and enhance security in access control and identity
verification.
9. Agriculture:
• Precision Farming: AI algorithms analyze data from sensors, satellites, and drones to optimize crop
yields, manage irrigation, and monitor soil health, increasing productivity and sustainability in
agriculture.
• Crop Monitoring: AI-based image analysis systems monitor crop growth, detect pests and diseases,
and provide insights for crop management decisions, improving crop health and yield outcomes.
AI applications have become ubiquitous in daily life, enhancing convenience, efficiency, and
personalization across various domains. Here are commonly used AI applications in daily life:
1. Online Shopping:
• Recommendation Systems: AI-powered recommendation engines suggest products based on past
purchases, browsing history, and user preferences, enhancing the shopping experience and
increasing sales.
• Visual Search: AI enables visual search capabilities, allowing users to search for products using
images instead of text descriptions.
2. Search Engines:
• Natural Language Processing (NLP): Search engines use NLP algorithms to understand user queries
and provide relevant search results.
• Personalization: AI algorithms personalize search results based on user behavior, location, and
interests, improving the accuracy and relevance of search results.
96 | P a g e
3. Chatbots:
• Customer Support: Chatbots provide instant assistance to users by answering questions, resolving
issues, and providing information about products or services.
• Conversational Interfaces: AI-powered chatbots engage in natural language conversations with
users, mimicking human-like interactions and improving user experience.
4. Voice Assistants:
• Virtual Assistants: Voice-activated virtual assistants such as Siri, Google Assistant, and Amazon Alexa
perform tasks, answer questions, and provide information based on voice commands.
• Natural Language Understanding: Voice assistants use NLP algorithms to interpret and process
spoken language, enabling hands-free interaction with devices and services.
5. Entertainment Portals:
• Content Recommendation: Streaming platforms and entertainment portals use AI algorithms to
recommend movies, TV shows, music, and other content based on user preferences and viewing
history.
• Content Creation: AI technologies generate content such as personalized playlists, curated news
feeds, and algorithmically generated music or art.
6. Facial Recognition:
• Biometric Authentication: Facial recognition technology is used for biometric authentication on
smartphones, laptops, and other devices, allowing users to unlock devices and access services
securely.
• Surveillance and Security: Facial recognition systems are used in surveillance cameras, access
control systems, and law enforcement applications for identifying individuals and enhancing
security.
7. Driver-Assisting Vehicles:
• Autonomous Driving: AI-powered driver-assisting systems such as adaptive cruise control, lane-
keeping assistance, and automatic emergency braking enhance vehicle safety and reduce the risk of
accidents.
• Advanced Driver-Assistance Systems (ADAS): AI algorithms analyze sensor data from cameras, radar,
and LiDAR to detect obstacles, pedestrians, and other vehicles on the road, enabling semi-
autonomous driving capabilities.
8. Augmented/Virtual Reality (AR/VR):
• Immersive Experiences: AR/VR applications provide immersive experiences in gaming, education,
training, and entertainment by overlaying digital content onto the real world or creating virtual
environments.
• Spatial Mapping: AI algorithms enable spatial mapping and object recognition in AR/VR
environments, enhancing realism and interactivity in virtual experiences.
97 | P a g e
AI in video streaming app:
• Personalized recommendations: AI can analyze user data like ratings, viewing history, and
demographics to suggest movies and TV shows. This can help improve the overall viewing experience
and increase user engagement.
• Content protection: AI can identify pirated streams, extract digital watermarks, and block users who
abuse the service.
• localization: AI can capture, translate, and upload subtitles, and source content titles, descriptions,
and technical details.
• Video quality: AI can enhance video quality.
• Metadata creation: AI can create rich metadata.
• Processing information: AI can process large amounts of information faster than usual.
• Video indexing: AI can anticipate consumers' needs and make video content more actionable.
Example:
Netflix uses artificial intelligence (AI) to improve the experience for its customers in several ways,
including:
• Content Recommendation:
Personalized content suggestions based on user viewing habits.
Machine learning adapts to users' preferences, improving recommendations over time.
• Auto-Generated Thumbnails:
Personalized thumbnails based on user interests to attract viewers.
Machine learning uses user data to create engaging thumbnail images that encourage content
exploration.
• Streaming Quality Optimization:
AI predicts network congestion and caches content on regional servers to minimize buffering and
ensure high-quality streaming.
• Content Quality Checks:
AI and data science assess video, audio, and subtitles to ensure content meets quality standards.
Human inspection complements AI for thorough quality assurance.
98 | P a g e
Activity:
Try your hands at the ancient art of shadow puppetry, with a little help from Al by visiting
https://experiments.withgoogle.com/shadow-art
o Your phone can automatically recognize faces in photos. It uses face recognition technology to
identify different people in your pictures.
o For example, it can detect your face in a photo and save it in your personal folder. If it detects your
parents' faces, their photos are saved in separate folders. This helps you easily organize and find
photos of specific people.
Facebook Auto-Tagging:
o When you upload photos on Facebook, its software uses face recognition to detect the people in
the photos.
o If Facebook recognizes a person's face (based on previous tagged photos), it will suggest or
automatically tag that person in other pictures, making it easier for you to share the right content
with your friends.
o These features are possible due to advancements in face recognition technology. This technology
can now accurately identify faces, even in different lighting or with slight changes in appearance,
thanks to machine learning and AI improvements in recent years.
99 | P a g e
Chatbots:
• A chatbot is an automated conversational AI that pretends to be human and carries out
programmed tasks based on specific triggers, responding through a web or mobile app. Much like
virtual assistants, these bots provide support for users in the same way as one would talk with
another person
• The chatbot can provide a personalized and real-time conversation with humans by analyzing input
data, running it through an algorithm, and responding with a natural-sounding reply.
• Through a series of guided conversations, AI chatbots give consumers the information they need
without the hassle of waiting for an email or customer service representative
• Chatbots can be categorized into five types: Menu or button-based chatbots, Rules-based chatbots,
AI-powered chatbots, Voice chatbots, and Generative AI chatbots.
100 | P a g e
Smart Speaker:
Smart speakers use artificial intelligence (AI) and natural language processing to understand and
respond to questions, perform tasks, and provide entertainment. They can pair with phones, tablets,
computers, and other smart speakers to create a multi-room soundscape.
• Voice commands. Built-in microphones let you ask questions, give commands or initiate actions
using natural language that is internally processed to provide relevant responses or perform
requested tasks.
• Calls and communication. Sending voice text messages or making phone calls without even
touching your smartphone makes communication more convenient than ever.
• Smart home control. Most smart speakers integrate with other smart home devices, allowing you
to control various aspects of your home just by speaking.
• Music playback and streaming. The best smart speakers for music have access to all of the popular
streaming services, letting you request specific songs, playlists, artists or genres.
• Entertainment and media control. Podcasts, audiobooks and radio stations can all be easily
streamed. Televisions can also be voice controlled if the speaker is integrated with a smart TV.
• Personal organization. Managing schedules and calendars, setting reminders and alarms, creating
to-do lists, setting up appointments and jotting down notes all help keep things organized.
Web Search:
• The aim of the search engine algorithm is to present a relevant set of high-quality search results that
will fulfill the user’s query/question as quickly as possible.
• When a search query is entered into a search engine by a user, all of the pages which are deemed
to be relevant are identified from the index and an algorithm is used to hierarchically rank the
relevant pages into a set of results.
• Location – Some search queries are location-dependent e.g. ‘cafes near me’ or ‘movie times’.
• Language detected – Search engines will return results in the language of the user, if it can be
detected.
101 | P a g e
• Previous search history – Search engines will return different results for a query dependent on what
user has previously searched for.
• Device – A different set of results may be returned based on the device from which the query was
made.
• It asks for details about your favorite artists when you first open the app (much like Spotify), and
this information is the first step in letting the algorithm know what type of music and video you
want to hear.
102 | P a g e
objects in the world, it would be nearly impossible to explicitly code in what every object is or could
be into the car's framework. However, if you teach the car to identify objects through machine
learning, it can make those decisions itself.
AI in Shopping:
• All you need is an Amazon account, the Amazon
Go app (which is free), and a recent iPhone or
Android device.
• When you arrive, scan the app’s QR code at the
entrance, and then feel free to put your phone
away—you won’t need it while shopping.
• Simply browse and shop like in any other store.
See something you like? Take it off the shelf.
Changed your mind? No problem, just put it back.
When you’re finished, you can head out.
• The checkout-free shopping experience is powered by the same technology used in autonomous
vehicles.
• Once you're done shopping, you can exit the store. Your receipt is automatically sent, and your
Amazon account is charged as you leave.
AI in Entertainment:
• AI technologies enable entertainment companies to understand their audience better and tailor
their content
• Advertising is one of the most common uses of AI in the entertainment industry. By leveraging
historical data, companies can make smarter decisions regarding personalised creatives and
reaching the right audience.
• AI technology enables voice synthesis for virtual reality content, dubbing and localization, and AI-
generated music and storytelling. This has not only reduced production costs but also opened up
new creative possibilities.
• Many media companies are now using automatic-speech-recognition (ASR) technology to caption
their videos, including live broadcasts in real-time.
103 | P a g e
AI in Gaming:
• Artificial intelligence (AI) has been a key part of video games since the 1950s, helping to create more
immersive and interactive experiences for players.
• A common example is for AI to control non-player characters (NPCs), which are often sidekicks, allies
or enemies of human users that tweak their behavior to appropriately respond to human players’
actions. By learning from interactions and changing their behavior, NPCs increase the variety of
conversations and actions that human gamers encounter.
• Artificial intelligence is also used to develop game landscapes, reshaping the terrain in response to
a human player’s decisions and actions.
• Detects cheating and hacking in online games to ensure a fair experience for all players.
AI in Music:
• Composition: AI-powered tools can generate musical ideas based on user inputs, such as mood,
genre, and instrumentation.
• Production: AI can improve sound quality, streamline the production workflow, and break up
existing compositions into stems for remixing.
• Performance: AI can listen to a human performer and perform accompaniment, or compose music
in response to a live performance.
• Restoration: AI can isolate elements on a track that are previously unusable due to noise or other
factors. For example, Peter Jackson's team used AI to isolate John Lennon's voice on a recording of
The Beatles' “Now And Then”.
104 | P a g e
• Inspiration: AI can help artists gain inspiration for new songs.
• Marketing and consumption: AI can be used to market and advertise music, and to support it over
time.
• The first known recording of computer-generated music was made in 1951 by British computer
scientist Alan Turing. Turing used a large computer in his laboratory at the Computing Machine
Laboratory in Manchester, England to record three melodies: "God Save the King", "Baa, Baa Black
Sheep", and "In the Mood".
• Google Magenta is an open-source project developed by Google that focuses on using machine
learning to create art and music. It is a platform that provides a collection of tools and models for
artists, musicians, and researchers to explore the possibilities of AI in the creative industry.
AI in Education:
105 | P a g e
• Artificial intelligence tools can help make global classrooms available to all including those who
speak different languages or who might have visual or hearing impairments.
• Creating access for “students who might not be able to attend school due to illness”
• Students who require learning at a different level or on a particular subject that isn’t available in
their own school.
• Students can use AI tools to help with schoolwork, such as drafting essays, learning languages, and
studying history and science. AI can also help students improve their digital literacy, critical thinking,
problem-solving, and creativity.
• AI can help teachers develop lesson and activity ideas, assignment and write reviews. AI can also
help teachers tailor educational content to individual student needs.
• AI solutions for education can check the homework, grade the tests, organize research papers,
maintain reports, make presentations and notes, and manage other administrative tasks.
• ChatGPT can capably handle translations and can serve as a language-learning tool, helping students
check their work and teaching them things like vocabulary and grammar.
• AI can be used to create interactive games and other teaching tools that can teach young children
academic or social skills.
• Artificial intelligence can also be used to power monitoring systems to help track children's behavior
to glean insights into their development.
Assignment:
Think and plan a small presentation on how AI could be used in classrooms. Which subjects could be
taught and how would teaching be different in an AI-enabled classroom?
106 | P a g e
AI in Space Exploration:
• AI can help spacecraft navigate, avoid
obstacles, adapt to changing environments,
or respond to emergencies. For example,
NASA's Mars 2020 rover Perseverance uses
an AI system called Terrain-Relative
Navigation to analyze images of the Martian
surface and adjust its landing position
accordingly.
• AI can help astronauts perform various tasks on board the spacecraft or the space station, such as
monitoring systems, controlling devices, conducting experiments, or providing companionship. For
example, CIMON is an AI assistant that can interact with astronauts on the International Space
Station (ISS) using voice and facial recognition.
• AI can help analyze the massive amounts of data collected by space missions, such as images,
signals, spectra, or telemetry.
AI in agriculture:
107 | P a g e
AI is transforming agriculture by improving efficiency, reducing costs, and increasing yields. Here are
some key uses of AI in agriculture:
1. Precision Farming: AI-powered tools help farmers monitor soil conditions, weather forecasts, and
crop health. This allows for precise application of water, fertilizers, and pesticides, optimizing
resource use and reducing waste.
2. Crop Monitoring and Disease Detection: AI-driven drones and sensors can capture detailed images
of crops, detecting signs of disease, pests, or nutrient deficiencies early, allowing for timely
intervention.
3. Automated Machinery: AI enables autonomous tractors, harvesters, and drones that can perform
tasks such as planting, weeding, and harvesting, reducing the need for manual labor.
4. Predictive Analytics: AI analyzes historical data and weather patterns to forecast yields, market
prices, and even suggest the best time for planting and harvesting.
5. Smart Irrigation Systems: AI systems optimize irrigation by monitoring soil moisture levels and
weather conditions, ensuring crops get the right amount of water without waste.
6. Supply Chain Optimization: AI can streamline the agricultural supply chain by predicting demand,
optimizing storage, and reducing spoilage through efficient logistics.
7. Robotic Harvesting: AI-powered robots can be used to pick fruits and vegetables, performing tasks
that require precision and can be done continuously, improving productivity.
8. Soil and Crop Analytics: AI-based platforms can analyze soil and crop data to recommend specific
treatments or interventions to improve soil health and boost crop yields.
Smart Transportation:
• One of the biggest transportation problems commuters face regularly is traffic congestion.
• To optimize traffic flow, AI algorithms analyze real-time data from various sources, including
sensors, traffic cameras, and GPS devices. Smart traffic management systems dynamically adjust
signal timings and reroute vehicles, reducing congestion and improving efficiency.
• The passengers are updated with essential information like feasible accident instances, traffic
predictions, or road blockages. In addition, they are notified about the shortest route, helping them
108 | P a g e
reach their destination without getting trapped in any traffic hassles. This way, AI not only resolves
the problem of unwanted traffic but also reduces wait times and improves road safety.
• A self-driving, electric tram that's guided not by tracks, but a double-dashed line painted on the
street. ART system is an intelligent rail system that runs on sensors and rubber wheels creating a
cross between a train, tram and bus.
• Drones can operate autonomously and are not subject to traffic congestion or other logistical
challenges that traditional delivery vehicles may face. This can lead to more efficient delivery routes,
reducing the time it takes to deliver packages.
• Drones can also be used for video recording and news reporting.
• Tesla car that can keep its systems activated off the highway and change lanes on its own.
AI in Literature:
109 | P a g e
• "The age of the cutting-edge writer" highlights how Artificial Intelligence (AI) is transforming the
literary world. AI can enhance understanding of reading preferences, link multi-genre books to
readers, predict bestsellers, create data-driven works, and assist in editing manuscripts with tools
like ProWritingAid. A survey by the Future of Life Institute's AI Impacts project anticipates AI will
write a bestseller by 2050.
• In Japan, AI is already competing in literary contests. The Nikkei Hoshi Shinichi Literary Award
accepts entries from AI without revealing their nature to judges. In a recent competition, 11 out of
1,450 submissions were partly written by AI, with one entry, "The Day a Computer Writes a Novel,"
advancing past the first round.
• WASP, an AI developed to understand poetry structures and simplify the creative process for
writers, draws inspiration from Spain's Golden Age literature. Another example of AI in literature is
"Harry Potter and the Portrait of What Looked Like a Large Pile of Ash," created by Botnik Studios.
This fan fiction was generated by an AI trained on the Harry Potter series, with human editors
selecting the best AI-generated text to form a coherent chapter.
AI in food Industries:
• Chatbots with AI capabilities provide prompt and effective customer service. They can process
orders, answer frequently asked questions, and manage reservation queries. It enhances customer
service and frees up employees to work on more difficult assignments.
• Ordering systems powered by artificial intelligence streamline the consumer experience by enabling
voice commands or restaurant management software for order placement. However, automated
payment methods that improve transaction speed and convenience include cashier less systems.
• Few restaurants have started using Robot-waiter to take orders from costumers.
• Robot in the restaurants also used for serving food, cleaning table , chopping vegetables.
110 | P a g e
Food ordering App
• Drive-thru digital menu board allow restaurants to quickly serve customers who are on the go and
need their meals to keep up with their busy schedules.
• Digital Ordering eliminate hold times while increasing average order value through digital ordering.
Allow guests to talk or type in their own words and place orders directly via phone, web, or SMS.
Our GXP can answer ordering questions, manage menu complexity, accommodate special
instructions, and create upsell opportunities.
111 | P a g e
AI in Restaurants:
AI is increasingly used in restaurants to enhance customer experience, streamline operations, and
improve efficiency.
• Voice Assistants and Chatbots: AI-driven voice assistants or chatbots handle customer orders via
apps, websites, or smart speakers, improving convenience and reducing wait times.
• Self-Ordering Kiosks: Restaurants like McDonald’s use AI in digital kiosks that allow customers to
place orders and customize meals. AI suggests items based on preferences, time of day, or
popularity.
• AI tailors menu offerings based on customer data such as previous orders, location, weather, or
local trends. For example, cold beverages may be promoted on hot days, while hearty meals may
be highlighted during colder weather.
• AI-Powered Recommendation Systems: AI suggests menu items or meal combos based on
customer preferences, increasing upselling opportunities.
• AI-Based Feedback Systems: AI tools analyze customer reviews and feedback to identify areas for
improvement, helping restaurants address issues in real-time and enhance the customer
experience.
• AI optimizes delivery routes for food delivery services, reducing delivery times and improving
efficiency.
• Some restaurants are exploring AI-powered delivery robots or drones to autonomously deliver food
to customers.
• AI helps track and manage inventory by predicting stock levels and automating reordering
processes. It ensures that ingredients are available without overstocking, reducing spoilage and
improving cost efficiency.
• Robotic Chefs and Cooking Assistants: AI-driven robots can handle tasks like flipping burgers,
making pizzas, or frying food, improving speed and consistency while reducing labor costs.
• AI in Food Preparation: AI systems can assist with food portioning and precision cooking, ensuring
consistency and reducing waste.
112 | P a g e
Example:
McDonald's plans to eventually roll out an AI-based ordering system to all 1,400 of its U.S. locations. The
system adapts the menu in real-time, based on factors such as popular choices at a specific restaurant
or to promote items that can be quickly prepared during peak hours.
Large chain restaurants like McDonald's have introduced smart kiosks as part of their "future
experience" initiative. These kiosks allow customers to order meals via a digital menu, with AI guiding
recommendations based on preferences or even local weather conditions. Customers can also
customize their orders, such as adding extra salt to fries or more sauce to burgers.
113 | P a g e
At McDonald's drive-thrus, the digital menu boards display popular items tailored to each restaurant,
powered by an AI-driven suggestion system.
Future innovations include virtual restaurants, which would eliminate the need for full-service dining
spaces (and staff) by focusing exclusively on home delivery.
AI in Sports:
The integration of artificial intelligence (AI) in sports has revolutionized data analysis, training,
performance optimization, fan engagement, and officiating. Here are the key points:
1. Data Analysis: AI excels in analyzing vast volumes of sports data, enhancing the accuracy of
predicting future outcomes.
2. Training and Performance: Companies use AI alongside IoT devices, like wearable tech, to gather
data aimed at optimizing athletes' training and performance.
3. Fan Engagement: Sports teams employ virtual assistants (chatbots) to answer fan inquiries about
live game information and team stats. Fans receive real-time notifications of key events in matches,
with AI-generated video clips integrated into scorecards and commentary, enriching the viewing
experience. Users can explore game details, enjoy auto-curated highlights, use free text search to
find specific match events, and create personalized playlists.
4. Scouting and Recruitment: AI helps in assessing potential recruits by tracking and analyzing players'
performances, aiding in investment decisions.
5. Officiating: AI is used in refereeing, with technologies like Hawk-Eye in cricket for LBW decisions.
AI in Healthcare:
• AI algorithms analyze medical images (X-rays, MRIs, CT scans) to detect abnormalities
• AI-powered chatbots provide patients with medical information, reminders for medication, and
support for managing chronic conditions
114 | P a g e
• AI-guided robots assist surgeons in performing precise and minimally invasive procedures.
• AI processes data from wearable devices that monitor vital signs, physical activity, and other health
metrics.
Assignment:
AI is a powerful tool; however, depending on how it is used, it can be a blessing or a curse. Discuss with
examples.
EXERCISE
A. FILL IN THE BLANKS
1. ____________is the world's most popular subscription-based video streaming offered worldwide.
2. _____________________ wizard can help you organize your photos so you can reconnect with
cherished memories quickly.
5. ________________ listen to sound waves and convert them into words using automatic speech
recognition (ASR) using a set of complex artificial intelligence (AI) technologies.
6. ________________systems can be trained using large volumes of data such as images, videos, and
text to identify and analyze objects and language.
8. IBM's Watson had created a six-minute long trailer for a horror movie called ________________.
115 | P a g e
10. _______________________ is a robot server created by Bear Robotics that can assist human servers,
using sensors to navigate crowded restaurants.
11. ______________________ is an Al company that has developed a hand-held scanner to classify the
contents of food at a molecular level.
12. ____________________ created this three-page work of fan fiction after training an algorithm on
the text of all seven Harry Potter books.
14. Farmers in _________________ have mobile-phone based tools to track the images of crops and
their infections.
15. Spotify utilizes Al through their predictive recommendation engine which enables them to curate
personalized playlists such as ______________________ and ______________________.
1. Define
(a) Chatbot
(a) Music
(c) Literature
(b) Transport
(d) Sports
C. SUBJECT ENRICHMENT
1. Visit: https://mysteryanimal.withgoogle.com/
Mystery Animal is a new spin on the classic 20-questions game. The computer pretends to be an animal,
and you have to guess what it is using your voice. Ask any yes-or-no question you want, like "Do you
have feathers?" or "Do you sleep at night?" Play it on a Google Home by saying "Hey Google, talk to
Mystery Animal," or try it on the site.
116 | P a g e
D. KNOWLEDGE HUB
https://intellipaat.com/blog/applications-of-artificial-intelligence/
https://data-flair.training/blogs/applications-of-artificial-intelligence/
E. EXPERIENTIAL LEARNING
https://youtu.be/YhSeTEumjVA
https://youtu.be/GgTfYXB3_Cs
117 | P a g e
Module 8: Ethical consideration in AI
• It provides a framework for making decisions about how we should act in different situations.
Ethics guides our behavior by helping us determine what actions are morally acceptable and what
actions are not.
• It involves principles like honesty, justice, respect, and responsibility, which help individuals and
societies make choices that promote well-being and fairness.
• AI Ethics Definition: AI ethics is about applying moral principles to the development and use of
artificial intelligence.
• Real-World Impact: Without ethics, AI can lead to unfair situations, like biased loan approvals or
unclear facial recognition systems.
• Purpose of AI Ethics: AI ethics aims to ensure fairness, accountability, transparency, and privacy
in AI.
• Goal for Data Scientists: By applying AI ethics, data scientists can make sure AI benefits everyone
in a fair and responsible way.
118 | P a g e
“The consequences of AI going wrong are severe so we have to be proactive rather than reactive.” ~Elon
Musk
Elon Musk's quote emphasizes that if AI malfunctions or is misused, the impact could be very serious.
Therefore, it's crucial to address potential risks in advance rather than waiting for problems to occur.
Building trust in AI is crucial for its widespread acceptance and successful integration into society. Trust
is essential because AI systems are increasingly being used in various aspects of life, from healthcare and
finance to law enforcement and personal assistants. If people do not trust these systems, they are less
likely to use them or support their adoption.
“The development of full artificial intelligence could spell the end of the human race. It would take off
on its own, and re-design itself at an ever-increasing rate. Humans, who are limited by slow biological
evolution, couldn’t compete, and would be superseded.”— Stephen Hawking
Stephen Hawking's quote warns that if AI reaches a level of intelligence greater than humans, it could
potentially redesign itself rapidly, outpacing human control. As AI evolves much faster than humans,
119 | P a g e
who are limited by slow biological evolution, it could eventually surpass and replace humanity, posing
an existential threat.
“AI will change the nature of creativity, so it’s important that we develop new ways to interact with
these machines.” – Yves Behar
Yves Behar's quote suggests that AI will transform how we approach creativity, making it essential to
find new ways to collaborate and interact with AI. As AI influences creative processes, humans need to
adapt and develop methods to work alongside these technologies effectively.
1. Fairness and Bias: AI systems can inherit biases from the data they are trained on, leading to unfair
outcomes, discrimination, and perpetuation of societal inequalities. Ethical AI design involves
addressing these biases and ensuring fairness in decision-making processes.
2. Transparency and Explainability: AI systems often operate as "black boxes," making it difficult to
understand how they arrive at their decisions. Ensuring transparency and explainability in AI
algorithms is essential for accountability and trustworthiness.
3. Privacy and Security: AI technologies often deal with sensitive data, raising concerns about privacy
infringement and security breaches. Ethical AI practices involve implementing robust privacy
protections and security measures to safeguard individuals' data.
4. Accountability and Responsibility: It's crucial to establish accountability and responsibility
frameworks for AI systems and their developers, users, and stakeholders. This includes addressing
issues such as liability for AI-related harms and ensuring mechanisms for recourse in case of errors
or misuse.
120 | P a g e
5. Human Control and Autonomy: Ethical AI design should prioritize human control and autonomy,
ensuring that humans remain in charge of critical decisions and that AI systems operate in alignment
with human values and goals.
6. Impact on Employment and Society: AI technologies have the potential to disrupt industries and
labor markets, raising concerns about job displacement and societal implications. Ethical
considerations include mitigating negative impacts on employment and ensuring that AI benefits
society as a whole.
7. Bias in Data and Algorithms: AI systems can perpetuate and even amplify existing biases present in
data and algorithms. Ethical AI design involves actively identifying and mitigating biases to prevent
discriminatory outcomes.
8. Environmental Impact: The development and deployment of AI technologies can have significant
environmental implications, such as increased energy consumption. Ethical considerations include
minimizing the environmental footprint of AI systems and promoting sustainability in AI
development.
9. Global Equity and Access: There are concerns about unequal access to AI technologies and benefits
across different regions and demographics. Ethical AI initiatives aim to promote global equity and
ensure that AI benefits are accessible to all.
10. Long-term Implications: Ethical AI discussions also consider the long-term implications of AI
development, including existential risks, unintended consequences, and societal transformations.
It's important to engage in proactive foresight and ethical foresight to anticipate and address
potential future challenges.
121 | P a g e
Example of Ethical issues in an AI Applications:
• Kalashnikov AI Weapon: Russian company Kalashnikov is developing an AI-powered "combat
module" that can autonomously target and fire on humans.
• Uber Self-Driving Car Incident: An Uber self-driving SUV killed a pedestrian in Tempe, Arizona,
marking the first known autonomous vehicle-related pedestrian death.
• Amazon Gender-Biased AI Recruiting Tool: Amazon's AI recruiting tool, used from 2014 to 2017, was
found to be biased against women due to training on male-dominated resumes. The tool has been
abandoned.
• Facebook Chatbots Develop Own Language: Facebook shut down two AI chatbots, Alice and Bob,
after they started communicating in a language they created, which researchers didn't fully
understand.
Activity:
Ask the students to visit the following website for different case studies on ethics and then discuss the
learnings from this in class.
https://en.unesco.org/artificial-intelligence/ethics/cases
122 | P a g e
Ethical Issues of AI:
Safety in AI:
• AI Safety: AI must avoid causing accidents or harmful behaviors, especially in autonomous
vehicles and drones.
• Shift in Decision-Making: Unlike the digital revolution, AI automates decisions, reducing human
control and transparency in decision-making.
• Human vs. AI Decisions: Human decisions are influenced by rules, values, and context, while AI
decisions may lack these nuances, leading to safety and ethical concerns.
• AI Vulnerabilities: AI, while enhancing cybersecurity, can be exploited through data manipulation
or altered objectives, posing significant risks in a connected world.
• Privacy Concerns: AI technologies, such as facial recognition and emotion analysis, collect vast
amounts of personal data, raising privacy issues.
• Bias and Errors: AI can reinforce biases from real-world data, leading to discriminatory practices,
as seen in Amazon's biased recruiting tool and ProPublica’s findings on a biased criminal justice
system. AI's limitations can also result in fatal errors, as seen in self-driving car accidents.
123 | P a g e
Examples of Ethics related to Robotics:
1. Robots should not be designed as weapons, except for national security reasons.
2. Robots should be designed and operated to comply with existing law, including privacy.
3. Robots are products: as with other products, they should be designed to be safe and secure.
4. Robots are manufactured artefacts: the illusion of emotions and intent should not be used to
exploit vulnerable users.
The term "robot ethics" (sometimes "roboethics") refers to the morality of how humans design,
construct, use and treat robots and other artificially intelligent beings. It considers both how artificially
intelligent beings may be used to harm humans and may be used to benefit humans.
• Deepfake technology is a form of AI that generates highly realistic images, videos, and audio that
appear genuine. The term "deepfake" combines "deep learning," which involves AI learning from
data to produce realistic outputs, and "fake."
• How Deepfakes are Made: AI is provided with images or videos of a person and activity. The more
data the AI receives, the more convincing the deepfake becomes.
• Uses of Deepfakes:
• Entertainment: Deepfakes can place characters in unusual scenarios, like portraying the Joker as
a medieval knight, or simply be used for humor.
• Training: Companies like Synthesia use deepfakes as a cost-effective alternative to hiring live
actors for training and HR videos.
124 | P a g e
• Propaganda: Deepfakes can disseminate false information, as seen when pro-China
propagandists used fake videos mimicking a news outlet in 2022.
• Risks of Deepfakes: Deepfakes can blur the line between real and fake, leading to confusion,
mistrust, and the spread of misinformation. They also pose risks to privacy and security.
AI for good:
• Human Rights: Human trafficking is a major issue in India, with 250,000 children reported missing
in the last five years. The Track Child project uses facial recognition to match missing children
with those in orphanages, identifying 2,930 kids in a few days.
• Agriculture: Imago AI, an Indian startup, uses AI to boost crop yields and reduce food waste. By
automating tasks like crop quality measurement and yield weighing, it helps farmers identify
diseased plants and optimize farming practices.
• Transparency: Promotes clear and understandable AI systems, allowing users to know how
decisions are made, which builds trust and accountability.
• Accountability: Establishes responsibility for AI outcomes, ensuring that developers and users
can be held accountable for the impact of AI systems.
• Privacy Protection: Safeguards personal data by enforcing ethical standards that prevent misuse
and unauthorized access, maintaining individual privacy.
• Safety and Security: Minimizes risks of harm by ensuring AI systems operate safely, especially in
critical areas like healthcare, autonomous vehicles, and military applications.
125 | P a g e
• Trust Building: Enhances public confidence in AI technologies by demonstrating a commitment
to ethical practices, which encourages broader adoption and acceptance.
• Social Good: Guides the development of AI towards applications that benefit society, such as
healthcare improvements, environmental conservation, and education.
• Long-term Sustainability: Encourages the development of AI systems that are sustainable and do
not exploit resources or cause long-term harm to the environment or society.
• Accountability: Establish clear lines of responsibility for the outcomes of AI systems, ensuring
that developers, operators, and users can be held accountable for their actions and the impacts
of the AI.
• Privacy Protection: Safeguard personal data by designing AI applications that respect user
privacy, with robust mechanisms to prevent unauthorized data access, misuse, or sharing.
• Safety and Security: Design AI systems to operate safely and securely, minimizing risks of harm
or unintended consequences, especially in critical sectors like healthcare, transportation, and
finance.
• Human Autonomy: Ensure that AI systems empower rather than undermine human decision-
making, maintaining human control over critical decisions and avoiding over-reliance on
automation.
• Social Responsibility: Guide AI development towards applications that benefit society as a whole,
promoting social good, public welfare, and ethical considerations in all AI initiatives.
• Inclusivity: Ensure that AI benefits all segments of society, including marginalized or underserved
groups, by making AI technologies accessible and avoiding the exacerbation of existing
inequalities.
• Ethical Use of Data: Promote the responsible and ethical use of data in AI applications, ensuring
that data collection, processing, and analysis are conducted in a manner that respects the rights
and dignity of individuals.
126 | P a g e
Assignment:
AI is a powerful tool: however, depending on how it is used, it can be a blessing or a curse. Discuss with
examples.
Assignment:
EXERCISE
A. MULTIPLE CHOICE QUESTIONS
(c) Samsung's new Facial recognition technologies (d) Technologies to manage crowds
4. Safety in Al can be understood as "Al must not cause accidents, or exhibit _________________.
2. Tay is an artificial intelligence chatter bot and is named "Tay" after the acronym ____________.
127 | P a g e
C. ANSWER THE FOLLOWING
1. A hospital shares the details of the patients with an insurance company. Do you think it is ethical?
Why/Why not?
3. Define Ethics.
4. Why did the Al chat bot by Microsoft close down after some hours of operation?
5. Your younger sibling has spent a lot of time in preparing a 3D model of India Gate which is 3 ft tall and
kept it on ground for safety concerns. Your mother started the autonomous robot to clean the floor and
it tries to clean the area near the model but it falls and breaks.
(a) Who can be held liable for damages caused by autonomous systems?
6. "Al is interdisciplinary in nature and its foundations are in various fields." Justify the statement with
valid points.
7. Which are the basic requirements that an Al program should fulfill? Explain any two along with an
example.
D. ASSESSMENT
1. Divide the class into two groups and conduct debates on the following topics
2. Divide the class into two groups and discuss what defines Ethics according to you in context of Artificial
Intelligent machines. The discussion should include points such as Trustworthiness, Respect,
Responsibility, Fairness, Caring and Honesty etc.
• Can we build Al without losing control over it?
• What happens when computers get smarter than we are?
3. Visit https://thing-translator.appspot.com/
Take the picture of any object using a webcam and check how the Al algorithm identifies that object.
E. KNOWLEDGE HUB
https://www.unesco.org/en/artificial-Intelligence/recommendation-ethics
https://www.scu.edu/ethics/all-about-ethics/artificial-intelligence-and-ethics-sixteen-challenges-and-
opportunities/
F. EXPERIENTIAL LEARNING
https://youtu.be/alzBQ24hD6s
128 | P a g e
Module 9: Conditional Statement
Selective statement:
In both everyday life and coding, making decisions is essential. We frequently come across situations
where we need to select a path, and these selections influence our next steps. Similarly, in programming,
we encounter circumstances where decisions are necessary to guide the sequence of our code.
Conditional statements in Python are vital in directing program execution. Among these, If-Else
statements are foundational, offering a method to run different sections of code depending on particular
conditions.
129 | P a g e
If Statement:
The if statement is the most simple decision-making statement. It is used to decide whether a certain
statement or block of statements will be executed or not.
Conditional statements are statements which execute based on some conditions.
if (condition):
Statements
The statements under ‘if’ are executed only when the ‘condition’ given is True.
Example: (To check if the entered username is valid or not)
name=‘Irobokid’
user_name=input(“Enter the user name”)
if (name != user_name):
print(‘Incorrect user name’)
As we know, Python uses indentation to identify a block. So the block under the Python if statements
will be identified as shown in the below example:
i = 10
if (i > 15):
print("10 is less than 15")
print("I am Not in if")
Output: I am Not in if
130 | P a g e
If Else Statement:
The if statement alone tells us that if a condition is true it will execute a block of statements and if the
condition is false it won’t. But if we want to do something else if the condition is false, we can use the
else statement with the if statement Python to execute a block of code when the Python if condition is
false.
Syntax of If Else:
if (condition):
# Executes this block if
# condition is true
else:
# Executes this block if
# condition is false
Example:
i = 20
if (i < 15):
print("i is smaller than 15")
print("i'm in if Block")
else:
print("i is greater than 15")
print("i'm in else Block")
print("i'm not in if and not in else Block")
131 | P a g e
Output:
i is greater than 15
i'm in else Block
i'm not in if and not in else Block
If-elif-else statement:
Here, a user can decide among multiple options. The if statements are executed from the top down.
As soon as one of the conditions controlling the if is true, the statement associated with that if is
executed, and the rest of the ladder is bypassed. If none of the conditions is true, then the final “else”
statement will be executed.
Syntax:
if (condition):
statement
elif (condition):
statement
.
.
.
else:
statement
132 | P a g e
Example:
In the example, we are showing single if in Python, multiple elif conditions, and single else condition.
i = 25
if (i == 10):
print("i is 10")
elif (i == 15):
print("i is 15")
elif (i == 20):
print("i is 20")
else:
print("i is not present")
Output: i is not present
Nested If Statement:
A nested if statement in Python is an if statement placed inside another if statement. It lets you add
additional layers of conditions within a block, allowing you to perform more complex decision-making in
your code.
Here's how it works:
The first if condition is checked.
If it’s True, the code inside it runs. This can include another if statement.
The inner if (the nested one) checks its condition.
If the inner condition is also True, its code runs; otherwise, it moves to the corresponding else statement
(if any).
133 | P a g e
Example:
x = 10
y=5
if x > 0: # Outer if
print("x is positive")
if y > 0: # Nested if inside the outer if
print("y is also positive")
else:
print("y is non-positive")
else:
print("x is non-positive")
• First, Python checks if x > 0. Since x is 10, which is positive, it prints "x is positive".
• Then it moves to the nested if y > 0 inside the first if.
• Since y is 5, it’s also positive, so it prints "y is also positive".
• If either x or y were non-positive, the appropriate else statements would execute.
EXERCISE
A. MULTIPLE CHOICE QUESTIONS
1. A variable that can only have one of two values, True or False are called
Friday = False
if Friday:
print("Jeans day!")
else:
print("Dress code")
134 | P a g e
4. What does an IF statement do?
5. The second part of If, that is executed when the condition is false
1. x = True
y = False
z = False
if x or y and z:
print ("yes")
else:
print ("no”)
2. x = True
y = False
z = False
if not x or y:
print(1)
elif not x or not y and z:
print(2)
elif not x or y or not y and x:
print(3)
else:
print(4)
135 | P a g e
C. ANSWER THE FOLLOWING
1. Write a Python program to input a number and display whether it is a prime number or not.
2. Write a Python program that inputs a number and checks whether the given number is odd or even.
3. Write a Python program that inputs a number and checks whether the number is divisible by 3 or
not.
4. Write a Python program that inputs two numbers and an arithmetic operator and displays the
calculated result.
6. Write a Python program to accept a character from the user and display whether it is a vowel or
consonant.
7. Write a Python program to accept a number and display whether the number is a palindrome or not.
136 | P a g e
Module 10: Control Statement
In Python, an iteration statement or loop is a way to repeatedly execute a block of code as long as a
condition is met. This is useful when you want to perform the same action multiple times without having
to write the code repeatedly.
Python has three types of loops:
1. for loop: Used when you know the exact number of times you want to execute the code.
2. while loop: Used when you want the code to execute as long as a certain condition is True.
3. Nested loops: A nested loop has one or more loops within the body of another loop. The two loops
are referred to as outer loop and inner loop.
1 - For Loop:
A for loop is a programming construct that allows a block of code to be executed repeatedly until a
certain condition is met.
The for loop works by running the code within its scope until the specified condition is no longer true,
allowing you to perform tasks such as iterating over a list, array, or collection until the end of the
sequence is reached, or performing a certain action a set number of times. In essence, a for loop is
designed to move to the next element in the sequence after each iteration, ensuring that each item is
processed.
It directly iterates over items of any sequence (such as a list or string), in the order that they appear,
without requiring the indexing used in some other languages. This feature simplifies the process of
looping through elements, making code more readable and concise.
137 | P a g e
Syntax:
for itarator_variable in sequence_name:
Statements
...
Statements
• The first word of the statement starts with the keyword “for” which signifies the beginning of the
for loop.
• Then we have the iterator variable which iterates over the sequence and can be used within the
loop to perform various functions
• The next is the “in” keyword in Python which tells the iterator variable to loop for elements within
the sequence
• And finally, we have the sequence variable which can either be a list, a tuple, or any other kind of
iterator.
• The statements part of the loop is where you can play around with the iterator variable and perform
various function
Example:
word="python" Output:
Range function()
The range() function is often used with for loops to specify the number of iterations.
138 | P a g e
Example 2: Output : 3
for i in range(3, 8): 4
print(i) 5
Output: 3 4 5 6 7 6
7
Output : 2
Example 3:
4
for x in range(2, 21, 2):
print(x) 6
Output: 2 4 6 8 10 12 14 16 18 20 8
10
12
14
16
18
20
Example 4:
Output : 1
# Define a list of numbers
2
numbers = [1, 2, 3]
3
# Iterate over the list using a for loop
for number in numbers:
print(number)
139 | P a g e
Break statement with for loop: Output : 0
for i in range(10): 1
if i == 5: 2
break 3
print(i) 4
140 | P a g e
2 - While Loop:
A while loop in Python programming language repeatedly executes a target statement as long as the
specified boolean expression is true. This loop starts with while keyword followed by a boolean
expression and colon symbol (:). Then, an indented block of statements starts.
Here, statement(s) may be a single statement or a block of statements with uniform indent. The
condition may be any expression, and true is any non-zero value. As soon as the expression becomes
false, the program control passes to the line immediately following the loop.
If it fails to turn false, the loop continues to run, and doesn't stop unless forcefully stopped. Such a loop
is called infinite loop, which is undesired in a computer program.
Syntax:
while expression:
statement(s)
141 | P a g e
Example1:
count=0
while count<5:
count+=1
print ("Iteration no. {}".format(count))
print ("End of while loop")
Output:
Iteration no. 1
Iteration no. 2
Iteration no. 3
Iteration no. 4
Iteration no. 5
End of while loop
Example 2:
counter = 0
while counter <= 10:
print ("Running infinitely, counter's value =", counter)
# we are never incrementing the counter
To avoid this issue, we need to increment the counter so that the loop will get terminated at a certain
specified condition.
142 | P a g e
Example:
num = 1
sum_result = 0
# While loop to calculate the sum
while (num <= 5):
sum_result += num
num += 1
else:
print("Loop completed. Sum =", sum_result)
143 | P a g e
Example:
The following program uses a nested while loop to find the prime numbers from 2 to 100 −
i=2
while(i < 25):
j=2
while(j <= (i/j)):
if not(i%j): break
j=j+1
if (j > i/j) : print (i, " is prime")
i=i+1
print ("Good bye!")
Output:
2 is prime
3 is prime
5 is prime
7 is prime
11 is prime
13 is prime
17 is prime
19 is prime
23 is prime
Good bye!
144 | P a g e
Jump Statements:
As the name suggests, a jump statement is used to break the normal flow of the program and jump onto
a specific line of code in the program if the specific condition is true. In simple words, it transfers the
execution control of the program to another statement if a specific condition associated becomes true.
As we proceed further you will get a better understanding of this concept.
Types of Jump Statements:
1 - Break:
As the name suggests, a break statement is used to break or stop a flow control. This is generally used
in a loop. A break statement is used in a loop in such a way, that when a particular condition becomes
true, the break statement is executed and we come out of the loop immediately at that moment.
Syntax:
Loop{
Condition:
break
}
Example:
Exit the loop when i is 3:
i=1
while i < 6:
print(i)
if i == 3:
break
i += 1
2 - Continue statement:
Python continue statement is used to skip the execution of the program block and returns the control
to the beginning of the current loop to start the next iteration. When encountered, the loop starts next
iteration without executing the remaining statements in the current iteration.
Python continue statement is used with 'for' loops as well as 'while' loops to skip the execution of the
current iteration and transfer the program's control to the next iteration.
The continue statement is just the opposite to that of break. It skips the remaining statements in the
current loop and starts the next iteration.
Syntax:
looping statement:
condition check:
continue
145 | P a g e
Example:
i=0
while i < 6:
i += 1
if i == 3:
continue
print(i)
3 - Pass Statement:
The pass statement is also known as the null statement. The Python mediator doesn't overlook a
Remark, though a pass proclamation isn't. As a result, these two Python keywords are distinct.
We can use the pass statement as a placeholder when unsure of the code to provide. Therefore, the
pass only needs to be placed on that line. The pass might be utilized when we wish no code to be
executed. We can simply insert a pass in cases where empty code is prohibited, such as in loops,
functions, class definitions, and if-else statements.
The syntax of the pass statement is:
Output: 0
pass
1
Example:
2
x=0
while x < 14: 3
if x > 4 and x < 11: 4
pass
print(x) 11
x += 1 12
13
146 | P a g e
EXERCISE
A. MULTIPLE CHOICE QUESTIONS
5. The condition for a while loop to continue could include which of the following?
number = 5
while number > 0:
number=number - 1
print (number)
147 | P a g e
7. Which is the correct output for: Output:
for i in range(1,10):
print(i)
10. What type of loop is used when you know how many times you want to repeat something?
13. What would the output for the code shown here?
a = 20
b=25
for Ip in range(5,100,10);
num = a + b
print(num)
148 | P a g e
(a) 35 (b) 39 (c) 45 (d) 44
14. What is the correct syntax to write a for loop to iterate through the list grades?
1. for i in range(2):
print(i)
for i in range(4,6):
print (i)
if 'amir' in namesi:
print (1)
else:
print (2)
1. In _____________ loop, It is known in advance how many times the loop is going to be executed.
2. The ______________ is a built-in function in Python used to create a list containing a sequence of
numbers.
3. What are iterative statements? Which are the iterative statements in Python?
6. What is the difference between finite and infinite loops? Explain by giving examples.
149 | P a g e
E. PRACTICE BASED QUESTIONS
1. Write a Python program to accept three integers and print the largest of the three.
3. Write a Python program to add the odd numbers up to a given value N and print the result.
4. Write a Python script to print Fibonacci series first 10 elements like 0112358
6. Write a Python program to display the sum of the digits of a given number.
6666
6666
6666
4321
432
43
F. ASSESSMENT
Sudoku is one of the most popular puzzle games of all time. The goal of Sudoku is to fill a 9x9 grid with
numbers so that each row, column and 3×3 section contain all of the digits between 1 and 9.
https://www.indiabix.com/puzzles/sudoku/
Divide the class into two groups. Discuss about the various kinds of puzzles like Number, Missing
Letters, Logical, card, clock puzzles etc. in class.
G. KNOWLEDGE HUB
https://pynative.com/python-control-flow-statements/
150 | P a g e
Module 11: AI Concepts
There are three main types of Artificial Intelligence: ANI vs. AGI vs. ASI
• Narrow AI, or Weak AI (ANI): ANI is mainly used to perform specific jobs without learning beyond
what it’s meant for.
• General AI, or Strong AI, and (AGI): AGI is like human intelligence and can do many things at once.
• Artificial Superintelligence (ASI): ASI is smarter than the human mind and can perform any task
better.
• Weak AI, on the other hand, is AI designed to perform specific tasks or solve particular problems
without true understanding or consciousness. It simulates intelligent behavior based on
algorithms and data but does not possess self-awareness. Examples include virtual assistants like
Siri and chatbots. Weak AI is widely used today.
• Example:
• Siri or Alexa: Voice assistants that can perform tasks like setting reminders or answering
questions.
• Google Maps: Uses AI to provide directions and real-time traffic updates.
• ChatGPT: Language models like this one that generate text based on input, without true
understanding.
151 | P a g e
Strong (General) AI:
• Strong AI refers to the concept of AI systems that possess human-like consciousness, self-
awareness, and the ability to understand, think, and learn at the same level as humans.
• These systems would not just simulate human behavior but actually have a mind capable of
reasoning, problem-solving, and even emotions.
• Strong AI does not currently exist. Strong AI is more of a theoretical concept at this point
152 | P a g e
Strong Vs Weak AI:
Scope and
Task-specific, narrow focus General intelligence, wide range of tasks
Functionality
Expert System:
• An expert system is an AI software designed to solve problems that typically require a human
expert, by using knowledge stored in a knowledge base.
• The process of creating an expert system is known as Knowledge Engineering, and the individuals
who perform this task are called Knowledge Engineers.
• Their main role is to ensure the computer has all the necessary knowledge to solve a problem,
represented symbolically in the computer's memory.
153 | P a g e
Advantage of Expert System:
• They can be used for risky places where the human presence is not safe.
• The performance of these systems remains steady as it is not affected by emotions, tension, or
fatigue.
• The response of the expert system may get wrong if the knowledge base contains the wrong
information.
• Like a human being, it cannot produce a creative output for different scenarios.
• For each domain, we require a specific ES, which is one of the big limitations.
154 | P a g e
2. DENDRAL
• Overview: DENDRAL is another pioneering expert system, developed in the 1960s, and is
regarded as one of the first successful AI systems in the field of chemistry.
• Functionality: DENDRAL was designed to analyze chemical compounds. It uses spectrographic
data (data obtained from spectroscopy) to predict the molecular structure of a substance.
• Significance: DENDRAL revolutionized chemical research by automating the analysis of mass
spectrometry data.
3. R1/XCON
• Overview: R1, also known as XCON, was developed in the late 1970s by Digital Equipment
Corporation (DEC) and is one of the most commercially successful expert systems.
• Functionality: R1/XCON was used to configure orders for new computer systems. It would select
the appropriate hardware and software components based on the customer’s requirements.
• Significance: R1/XCON streamlined system configuration, saving DEC millions by reducing errors
and improving efficiency.
4. PXDES
• Overview: PXDES is an expert system designed for the medical field, particularly in the diagnosis
of lung cancer.
• Functionality: PXDES could analyze patient data, including imaging results, to determine both the
type and the stage of lung cancer. It helps in deciding the best course of treatment based on the
patient’s specific condition.
• Significance: PXDES aids in accurate, timely diagnoses, improving treatment decisions in oncology.
5. CaDet
• Overview: CaDet is a clinical support system developed to assist in the early detection of cancer.
• Functionality: CaDet can identify potential signs of cancer in its early stages by analyzing patient
data and symptoms. It works by comparing patient data with known patterns and indicators of
cancer.
• Significance: Early detection by CaDet enhances survival rates by enabling prompt treatment.
6. DXplain
• Overview: DXplain is a medical expert system developed at Massachusetts General Hospital, used
as a clinical decision support tool.
• Functionality: DXplain suggests possible diseases based on the symptoms and findings provided
by a doctor. It acts as a reference tool, offering a differential diagnosis list that doctors can use to
check their own diagnoses.
• Significance: DXplain broadens diagnostic possibilities, helping medical professionals consider
rare conditions.
155 | P a g e
• Customer Support: Automated troubleshooting and service.
Human Vision:
• Vision is about discovering from images what is present in the scene and where it is?
• Human vision is the natural process by which the human brain and eyes work together to perceive
the world.
• The eye captures light and images, and the brain interprets these signals to understand what we see.
• The human visual system has key components:
• Eyes: Capture light and convert it into electrical signals.
• Retina: Contains photoreceptor cells that sense light and color.
• Optic Nerve: Transmits visual information from the eyes to the brain.
• Brain: Processes signals and forms an understanding of shapes, colors, movement, depth, and
distance.
Human vision is a complex, intuitive process that allows us to quickly recognize objects, people, and
environments, even in low-light or complex settings.
Computer Vision:
Computer vision is a field of artificial intelligence that trains computers to interpret and understand the
visual world.
Using digital images from cameras and videos and deep learning models, machines can accurately
identify and classify objects — and then react to what they “see.”
156 | P a g e
• Computer vision mimics how the human brain recognizes objects.
• The brain uses patterns to decode visual objects.
• Computer vision systems rely on pattern recognition.
• Algorithms are trained on large datasets of images to identify patterns.
• For example, feeding the system millions of flower images helps it create a model of a "flower."
• The computer then accurately detects flowers in future images based on this model.
157 | P a g e
Application of Computer Vision:
1. Face Filters:
• Have you ever used the app called Snapchat?
• If yes, then you would have tried, at least
once, to use one of those super weird face
filters that come along with it.
• But haven’t you ever been curious as to how
Snapchat manages to rightly put a filter on
your face?
• Well, it uses the technology of Computer
Vision.
• The Face Filters using Computer Vision application uses a specific area of Computer Vision called
Image processing. The application, broadly, works in three simple steps.
• The first step is called Face Detection where all the human faces that are present in the image or
video are found out.
• The second step is called Facial Landmarks Extraction where the facial features of each detected
face, such as the eyes, lips, bone, nose, mouth, etc. are extracted.
• The third and the final step is called Image Processing where the chosen filter is finally applied onto
a full face.
• The best feature of the Face Filters using Computer Vision application is that it is very accessible to
every regular person and hence, it is an easy-to-use application.
158 | P a g e
3. Google Image Recognition:
• Google Lens is an image recognition technology developed by Google, designed to bring up relevant
information related to objects it identifies using visual analysis based on a neural network.
• Image Recognition: Google Lens identifies objects in pictures using computer vision.
• Neural Network: AI compares the image to a huge database to find matches.
• Visual Analysis: It breaks down the image into parts (colors, shapes) to understand it.
• Searchable Tags: Tags (like "dog" or "plant") are created to describe the image.
• Machine Learning: Google Lens improves by learning from millions of images over time.
159 | P a g e
4. Google Translate App:
• You can utilize your phone's camera to interpret text from your
surroundings using the Translate app.
• For instance, you can translate street signs or handwritten notes.
• Simply aim your phone's camera at the text, and the Google Translate
app will quickly display the meaning in your chosen language.
• This tool leverages optical character recognition to capture the text and
augmented reality to project a precise translation, making it a
convenient solution powered by Computer Vision.
The Healthcare industry is rapidly adopting new technologies and automation solutions, one of which is
computer vision. In the healthcare industry, computer vision has the following applications:
o X-Ray Analysis
Computer vision can be successfully applied for medical X-ray imaging. Although most doctors still
prefer manual analysis of X-ray images to diagnose and treat diseases, with computer vision, X-ray
analysis can be automated with enhanced efficiency and accuracy. The state-of-art image
recognition algorithm can be used to detect patterns in an X-ray image that are too subtle for the
human eyes.
o Cancer Detection
Computer vision is being successfully applied for breast and skin cancer detection. With image
recognition, doctors can identify anomalies by comparing cancerous and non-cancerous cells in
images. With automated cancer detection, doctors can diagnose cancer faster from an MRI scan.
160 | P a g e
o CT scan and MRI
Computer vision has now been greatly applied in CT scans and MRI analysis. AI with computer
vision designs such a system that analyses the radiology images with a high level of accuracy,
similar to a human doctor, and also reduces the time for disease detection, enhancing the chances
of saving a patient's life. It also includes deep learning algorithms that enhance the resolution of
MRI images and hence improve patient outcomes.
With the enhanced demand for the transportation sector, there has occurred various technological
development in this industry, and one of such technologies is Computer vision. Below are some popular
applications of computer vision in the transportation industry:
o Self-driving cars
Computer vision is widely used in self-driving cars. It is used to detect and classify objects (e.g.,
road signs or traffic lights), create 3D maps or motion estimation, and plays a key role in making
autonomous vehicles a reality.
o Pedestrian detection
Computer vision has great application and research in Pedestrian detection due to its high impact
on the designing of pedestrian systems in various smart cities. With the help of cameras,
pedestrian detection automatically identifies and locate the pedestrians in image or video.
Moreover, it also considers the variations among pedestrians related to attire, body position, and
illuminance in different scenarios. This pedestrian detection is very helpful in different fields such
as traffic management, autonomous driving, transit safety, etc.
161 | P a g e
o Road Condition Monitoring & Defect detection
Computer vision has also been applied for monitoring the road infrastructure condition by
accessing the variations in concrete and tar. A computer vision-enabled system automatically
senses pavement degradation, which successfully increases road maintenance allocation efficiency
and decreases safety risks related to road accidents.
To perform road condition monitoring, CV algorithms collect the image data and then process it to
create automatic crack detection and classification system.
In the manufacturing industry, the demand for automation is at its peak. Many tasks have already been
automated, and other new technology innovations are in trend. For providing these automatic solutions,
Computer vision is also widely used. Below are some most popular applications
o Defect Detection
This is perhaps, the most common application of computer vision. Until now, the detection of
defects has been carried out by trained people in selected batches, and total production control is
usually impossible. With computer vision, we can detect defects such as cracks in metals, paint
defects, bad prints, etc., in sizes smaller than 0.05mm.
162 | P a g e
o Analyzing text and barcodes (OCR)
Nowadays, each product contains a barcode on its packaging, which can be analyzed or read with
the help of the computer vision technique OCR. Optical character recognition or OCR helps us
detect and extract printed or handwritten text from visual data such as images. Further, it enables
us to extract text from documents like invoices, bills, articles, etc. and verifies against the
databases.
o Fingerprint recognition and Biometrics
Computer vision technology is used to detect fingerprints and biometrics to validate a user's
identity.
Biometrics is the measurement or analysis of physiological characteristics of a person that make a
person unique such as Face, Finger Print, iris Patterns, etc. It makes use of computer vision along
with knowledge of human physiology and behaviour.
o 3D Model building
3D model building or 3D modelling is a technique to generate a 3D digital representation of any
object or surface using the software. Computer vision plays its role here also in constructing 3D
computer models from existing objects. Furthermore, 3D modelling has a variety of applications in
various places, such as Robotics, Autonomous driving, 3D tracking, 3D scene reconstruction, and
AR/VR.
163 | P a g e
8. Computer Vision in Agriculture
In the agriculture sector, Machine Learning has made a great contribution with its models, including
Computer vision. It can be used in areas such as crop monitoring, weather analysis, etc. Below are some
popular cases of computer vision applications in Agriculture:
o Crop Monitoring
In the agriculture sector, crop and yield monitoring are the most important tasks for better
agriculture. Traditionally, it depends on subjective human judgment, but that is not always
accurate. With computer vision systems, real-time crop monitoring and identification of any crop
variation due to any disease or deficiency of nutrition can be made.
o Automatic Weeding
An automatic weeding machine is an intelligent project enabled with AI and computer vision that
removes unwanted plants or weeds around the crops. Traditionally weeding methods require
human labour, which is costly and inefficient compared to automatic weeding systems.
Computer vision enables the intelligent detection and removal of weeds using robots, which
reduces costs and ensures higher yields.
o Plant Disease Detection
Computer vision is also used in automated plant disease detection, which is important at an early
stage of plant development. Various deep-learning-based algorithms use computer vision to
identify plant diseases, estimate their severity and predict their impact on yields.
164 | P a g e
9. Computer Vision in Retail
In the retail sector, computer vision system enables retailers to collect a huge volume of visual data and
hence design better customer experiences with the help of cameras installed in stores. Some popular
applications of computer vision in the retail industry are given below:
o Self-checkout
Self-checkout enables the customers to complete their transactions from a retailer without the need
for human staff, and this becomes possible with computer vision. Self-checkouts are now helping
retailers in avoiding long queues and manage customers.
o Automatic replenishment
Automated stock replenishment is a leading technology innovation in retail sectors. Traditionally,
stock replenishment is performed by store staff, who check selves to track the items for inventory
management. But now, automatic replenishment with computer vision systems captures the
image data and performs a complete inventory scan to track the shelves item at regular intervals.
o People Counting
Nowadays, various situations occur where we may need the count of people or customers
entering and leaving the stores. This foot count or people counting can be done by computer
vision systems that analyze the image or video data captured by the in-store cameras. People
counting is helpful in managing the people and allowing the limited people for cases such as Covid
social distancing.
o Example: Amazon Go stores offer a checkout-free shopping experience in Seattle and Chicago.
Customers use the Amazon Go app to enter the store, which is linked to their Amazon account.
Hundreds of cameras and sensors track customer movements and monitor what items they take or
return. Uses computer vision, sensor fusion, and deep learning (similar to self-driving cars) to detect
and track shopping activities. There are no lines or physical checkout counters; customers simply
walk out when they finish shopping. Products are automatically charged to the customer's Amazon
account when they leave the store.
165 | P a g e
Activity: https://emojiscavengerhunt.withgoogle.com/
Human Language:
• Language is a tool through which humans exchange their ideas and thoughts among themselves.
Human language is a system of communication that allows humans to express themselves
through spoken, written, or signed symbols.
• Understanding human language is hard for computers because of the vast combinations of words
and the existence of thousands of languages.
• The human brain processes language using specific areas like Broca’s area (linked to speech
production) and Wernicke’s area (linked to understanding speech).
• To speak, the brain converts thoughts into language by choosing words, structuring them, and
then producing sounds through the coordination of the vocal cords, mouth, and lungs.
• Computer languages, on the other hand, are synthetic and used for communication between
computers and humans.
166 | P a g e
What is Natural language processing:
Natural Language Processing (NLP) is a field of artificial intelligence (AI) that focuses on the interaction
between computers and humans through natural language. It enables computers to understand,
interpret, and generate human language.
The goal of NLP is to enable computers to understand, interpret, and generate human language in a way
that is both meaningful and useful. It is the technology behind many language-based applications such
as chatbots, translation tools, and virtual assistants (e.g., Siri, Alexa).
NLP bridges the gap between human communication and computer understanding, enabling computers
to process language in a way that helps them interact more naturally with humans.
Challenges in NLP:
• Language Differences: Complexity due to diverse languages, grammar, vocabularies, and
context-specific meanings.
• Training Data: Need for large, high-quality labeled data for accurate model training.
• Development Time & Resources: High resource and time demands for complex NLP tasks, data
processing, and training models.
167 | P a g e
• Phrasing Ambiguities: Difficulty in resolving multiple meanings from a single phrase due to
context.
• Misspellings & Grammatical Errors: Challenges in handling linguistic noise and errors in text.
• Mitigating Biases: Ensuring fairness and reducing biases in training data and models.
Application of NLP:
1. Email Filters:
One of the most irritating things about email is spam. Gmail uses natural language processing
(NLP) to discern which emails are legitimate and which are spam. These spam filters look at the
text in all the emails you receive and try to figure out what it means to see if it’s spam or not.
168 | P a g e
• Email filters check for spam or phishing red flags and move emails to separate folders.
• Spam filters flag emails based on trigger words, unknown senders, and flagged IP addresses.
• You can release, block, or permit flagged emails for future handling.
2. Smart Assistant:
• In today’s world, every new day brings in a new smart device, making this world smarter and
smarter by the day. And this advancement is not just limited to machines.
• We have advanced enough technology to have smart assistants, such as Siri, Alexa, and Cortana.
• We can talk to them like we talk to normal human beings, and they even respond to us in the
same way. All of this is possible because of Natural Language Processing.
• It helps the computer system understand our language by breaking it into parts of speech, root
stem, and other linguistic features.
• It not only helps them understand the language but also in processing its meaning and sentiments
and answering back in the same way humans do.
169 | P a g e
3. Sentiment Analysis:
• The daily conversations, the posted content and comments, book, restaurant, and product
reviews, hence almost all the conversations and texts are full of emotions.
• We as humans can interpret emotional sentiments in writings and conversations, but with the
help of natural language processing, computer systems can also understand the sentiments of a
text along with its literal meaning.
4. Chat Bots
• With the increase in technology, everything has been digitalized, from studying to shopping,
booking tickets, and customer service.
• Instead of waiting a long time to get some short and instant answers, the chatbot replies instantly
and accurately.
• NLP gives these chatbots conversational capabilities, which help them respond appropriately to
the customer’s needs instead of just bare-bones replies.
• Chatbots operating on NLP also have emotional intelligence, which helps them understand the
customer’s emotional sentiments and respond to them effectively.
170 | P a g e
• Eliza is one of the first chatbots ever created (1964).
• Mitsuku is one of the most advanced chatbots currently in existence. It won various prizes and
can talk about most topics.
• Mitsuku, a record breaking five-time winner of the Loebner Prize Turing Test, is the world's best
conversational chatbot. As featured in the New York Times, Wall Street Journal, BBC, Guardian,
Wired, and more. To start chatting click on given link: https://www.pandorabots.com/mitsuku/
171 | P a g e
Script Bot Smart Bot
Scripted bots are easy to make and does not Smart bots are comparatively difficult to
carry glimpse of AI make and built on NLP and ML.
No or little language processing skill NLP and machine learning skills are required
Script bots work around a script which is Smart bots work on bigger databases and
programmed in them other resources directly
• These neurons communicate with each other through electrical and chemical signals to process
information and control various functions of the body, such as movement, sensation, thought, and
memory.
This model aids in understanding neural processing and learning in biological systems.
1. Neurons: The basic units of the network, specialized cells that transmit information.
2. Synapses: The connections between neurons, where the transmission of signals occurs through
neurotransmitters.
172 | P a g e
3. Dendrites: Branch-like structures that receive signals from other neurons.
4. Axons: Long, thin structures that carry signals away from the neuron to other neurons.
5. Neurotransmitters: Chemicals that transmit signals across synapses from one neuron to another.
Neural networks were first suggested in 1944 by two researchers, Warren McCullough and Walter Pitts,
at the University of Chicago. In 1952, they moved to MIT and helped start what is sometimes called the
first cognitive science department.
In 1958, psychologist Frank Rosenblatt created the first artificial neural network called Perceptron. It
was designed to mimic how the human brain processes visual information and learns to recognize
objects. Since then, other scientists have used similar neural networks to study how people think.
• A neural network, or artificial neural network, is a type of computing architecture that is based on a
model of how a human brain functions — hence the name "neural."
• These nodes pass data to each other, just like how in a brain, neurons pass electrical impulses to each
other.
Neural Network is made of interconnected nodes (neurons) in three types of layers: input, hidden, and
output.
• Input Layer: Contains neurons representing input data features, each corresponding to a specific
feature's value.
• Hidden Layers: Perform complex computations, receiving inputs from previous layers, applying a
weighted sum, adding bias, and using an activation function. There can be multiple hidden layers
between the input and output layers.
• Output Layer: Produces the final prediction or result, with neurons based on the problem type (e.g.,
one neuron per class in binary classification).
173 | P a g e
Working of Neural Network:
• Neural networks are made up of nodes across layers: input, hidden, and output.
• Each node processes input data using a mathematical formula with weighted variables.
• If the formula's result exceeds a threshold, the node passes data to the next layer.
• Neural networks work like an approval process: data moves through layers like expenses move
through management levels.
• Nodes can communicate in multiple directions, similar to managers consulting each other before
passing decisions.
174 | P a g e
Features Artificial Neural Network Biological Neural Network
175 | P a g e
Application of Neural Network:
• Image and Video Recognition: Neural networks can identify objects, people, or scenes in images and
videos. This is used in facial recognition, medical image analysis (e.g., detecting tumors), and self-
driving cars (for interpreting surroundings).
• Natural Language Processing (NLP): Neural networks power applications like language translation,
sentiment analysis, and chatbots. They help computers understand and generate human language.
• Speech Recognition: Systems like virtual assistants (e.g., Siri, Alexa) use neural networks to convert
spoken language into text and respond accordingly.
• Healthcare: Neural networks assist in diagnosing diseases, predicting patient outcomes, and even
personalizing treatment plans based on medical records and genetics.
• Financial Forecasting: In finance, neural networks are applied for stock market prediction, fraud
detection, and risk assessment by analyzing vast amounts of financial data.
• Autonomous Vehicles: Neural networks are critical in self-driving cars for tasks like object detection,
lane keeping, and decision-making in real-time driving scenarios.
• Gaming: Neural networks are used in creating adaptive and intelligent behavior in non-player
characters (NPCs) and improving game experiences.
• Robotics: Neural networks help robots to learn from experiences, adapt to new environments, and
improve tasks like navigation and object manipulation.
• Recommender Systems: Platforms like Netflix, YouTube, and Amazon use neural networks to suggest
movies, videos, or products based on user preferences.
• Predictive Maintenance: Neural networks can predict when machines or systems are likely to fail by
analyzing data from sensors, helping reduce downtime and maintenance costs.
EXERCISE
A. MULTIPLE CHOICE QUESTIONS
1. _____________ is a field of computer science that works on enabling computers to see, identify and
process images in the same way that human vision does, and then provide appropriate output.
176 | P a g e
3. An application lets you search what you see, get things done faster and understand the world around
you - using just your camera or a photo. Which domain does this app belong to?
6. Computer vision is concerned with modeling and replicating human vision using computer software
and hardware.
9. _______________ analysis is the Interpretation and classification of emotions (positive, negative and
neutral) within text data using text analysis techniques.
10. No or little language processing skills are required while making ______________.
11. Which of the following is the type of data used by NLP applications?
177 | P a g e
12. The main function of smart assistants like Apple Siri and Amazon Alexa is
(a) Trying to recognize the voice (b) Trying to read from the dictionary
(c) Searching the word from the database (d) None of these
(A) Input Layer (i) has its own machine learning algorithm to be executed
(B) Hidden layer (ii) meant for user interface
(C) Output Layer (iii) acquire the data fed into the neural network
3. Write five ways in which the functionality of Radiologists can be augmented using computer vision.
4. Explain any four areas where Natural Language Processing is being used.
178 | P a g e
6. Differentiate between script bot and smart bot.
C. SUBJECT ENRICHMENT
1. https://autodraw.com
Autodraw.com is an Al enabled tool which is based on the domain of Computer Vision in which the
machine identifies the pattern of your drawing and accordingly maps it with the most similar image. This
tool shows various options trying to predict what the user is trying to draw. For example, If a user is
trying to draw a tent and he starts with drawing a basic triangle, the machine would compare his drawing
and would show the possible outcomes for the same. The user can then select out of them which one is
the most appropriate form for him/her.
179 | P a g e
• Input layer nodes cannot discuss the image shown with each other. Everyone has to use their own
discretion
• No sentences or multiple words are to be written on the chit. Only one word per chit is allowed.
• Once the task of a layer is finished, that layer needs to go and sit aside and not disturb others till
the game ends.
Game Instructions:
• Input Layer:
o 7 students will be standing as the nodes of an Input layer.
o All of them will be shown an Image. After looking at it, they need to write 6 different words on
6 different chits. They have to choose the words which describe the image in the best way
possible. They can also repeat the words if needed.
o After making these chits, they need to pass on one chit to each of the nodes of the hidden layer
1. That is, 1 chit will be given to one member.
• Hidden Layer 1:
o 6 students will be standing as the nodes of hidden layer 1.
o Each of them will receive 7 chits from 7 different input nodes. Now they have to take a good
look at the chits and then write down 4 different words on different chits. For this, they can
either use the same words as the input layer did, or they can make their own information
(relevant to the context) and write it.
o Now these 4 chits are to be given randomly to any 4 nodes of Hidden Layer 2. Out of the 6
nodes of Hidden Layer 2, one can choose any 4 and give one chit to each.
• Hidden Layer 2:
o 6 students will be standing as the nodes of hidden layer 2
o Each one of them will get some number of chits from the previous layer. Now they have to
perform the same task as hidden layer 1 and have to write down 2 different words on 12
different chits and pass it on to the output layer.
• Output Layer:
o Finally, the output layer node will get 12 chits. Now she or he has to understand all the words
and has to guess which image was shown to the input layer initially.
o Output layer will then write a summary out of all the words received to explain his/her
deduction. The summary should not be more than 5 lines.
• Finally, the output layer presents this summary in front of everyone and the real image is finally
revealed to all.
• If the summary is accurate enough, the whole network wins, else they lose.
180 | P a g e
D. ASSESSMENT
1. Go to the following link www.piskelapp.com and create your own pixel art. Try and make a GIF using
the online app for your own pixel art.
2. Botsify is a platform where you can create your own automated chatbots online. Try creating chatbots
and experience innovative learning, where you can interact with the chatbot, ask and answer questions
and even submit quizzes through the chatbot.
E. KNOWLEDGE HUB
https://www.ibm.com/in-en/topics/computer-vision
https://viso.ai/applications/computer-vision-applications/
https://www.ibm.com/in-en/topics/natural-language-processing
https://towardsdatascience.com/your-guide-to-natural-language-processing-nlp-48ea2511f6e1
https://www.simplilearn.com/tutorials/deep-learning-tutorial/what-is-neural-network
https://towardsdatascience.com/a-concise-history-of-neural-networks-2070655d3fec
F. EXPERIENTIAL LEARNING
https://youtu.be/OcycT1Jwsns
https://youtu.be/fLvJ8VdHLA0
https://youtu.be/0m2r9elReBY
https://youtu.be/jmmW0F0biz0
https://youtu.be/JrXazCEACVo
181 | P a g e
Module 12: Components & Stages (AI Project Cycle)
A project life cycle is the set of steps a project goes through from the start to the finish. While every
project has a clear beginning and end, the specific goals, results, and tasks can be very different. The
project cycle provides a basic outline of what needs to be done in the project, no matter the exact work
involved.
Just as we naturally make plans to get things done, the AI project cycle gives us a structured way to work
on AI projects.
• The main goal of the AI project cycle is to make developing AI projects easier to understand and
manage.
• It breaks the process into clear phases, making each step more specific. This approach helps us get
the best results.
• It primarily consists of stages that describe the entire development process into clear and specific
steps.
Imagine you want to make a birthday card for your mom. You’re really excited and have lots of ideas.
Here are some steps you might follow to complete this task:
1. Look for cool card ideas. You might go online to watch videos or ask someone with experience.
2. After choosing a design, make a list of the things you need to create the card.
3. Check if you already have these materials. If not, go out and get what you need.
4. Once everything’s ready, start making the card.
5. If you make a mistake that you can’t fix, start over and remake it.
6. After finishing the card, give it to your mom.
Problem
Scoping
Data
Evaluation
Acquisition
Data
Modeling
Exploration
182 | P a g e
1. Problem Scoping:
Problem scoping is identifying an issue or opportunity that can be solved using AI. This involves
defining the problem, setting goals, and determining success criteria. A deep understanding of the
issue is essential, and the 4Ws problem canvas helps clarify this.
2. What? : This block helps to determine the nature of the problem. What is the problem and how do
we know that it is a problem? Under this block, we also gather evidence to prove that the problem
you have selected actually exists. Below are the questions that we need to discuss under this block.
3. Where? : This block will help us to look into the situation in which the problem arises, the context
of it, and the locations where it is prominent. Here is the Where Canvas:
4. Why? : In the “Why” canvas, we think about the benefits which the stakeholders would get from
the solution and how it will benefit them as well as the society. Below are the questions that we need
to discuss under this block.
1. What would be of key value to the stakeholders?
2. How would it improve their situation?
2. Data Acquisition:
This is the second stage of AI Project cycle. According to the term, this stage is about acquiring data
for the project. Whenever we want an AI project to be able to predict an output, we need to train it
first using data. For example, If you want to make an Artificially Intelligent system which can predict
the salary of any employee based on his previous salaries, you would feed the data of his previous
salaries into the machine. The previous salary data here is known as Training Data while the next
salary prediction data set is known as the Testing Data. Data features refer to the type of data you
want to collect. In above example, data features would be salary amount, increment percentage,
increment period, bonus, etc.
183 | P a g e
There are various methods to gather this data, such as follows:
1. Surveys
2. Web Scraping
3. Sensors
4. Cameras
5. Observations
3. Data Exploration:
Data can be tricky, often just a bunch of numbers. To understand it better, we need to find patterns,
and that’s where data visualization helps. It turns numbers into pictures that are easier to understand.
• Spotting Trends and Patterns: Charts and graphs help you quickly see if something is increasing,
decreasing, or staying the same.
• Choosing the Right Tools: Data visualization helps you choose the best method for further
analysis, like picking the right tool for a task.
• Sharing Insights: Once you find something interesting, visuals make it easier to explain your
findings to others.
You can use things like bar graphs, line charts, or pie charts to make the data clearer and more
understandable.
4. Modeling:
The graphical representation makes the data understandable for humans as we can discover trends
and patterns out of it, but machine can analyse the data only when the data is in the most basic form
of numbers (which is binary – 0s and 1s).
The ability to mathematically describe the relationship between parameters is the heart of every AI
model. Generally, AI models can be classified as follows:
184 | P a g e
a. Rule-Based Approach:
b. Learning-Based Approach:
• Divided into:
Key Difference: Rule-based systems are fixed, while learning-based systems evolve with data.
5. Evaluation
• Once a model has been made and trained, it needs to go through proper testing so that one can
calculate the efficiency and performance of the model.
• Hence, the model is tested with the help of Testing Data and the efficiency of the model is
calculated on the basis of the parameters mentioned below:
1. Accuracy: Accuracy gives us an overall view of the model’s correctness. It calculates the
percentage of correct predictions (both true positives and true negatives) over the entire dataset.
185 | P a g e
2. Precision: Precision helps us understand how good the model is at avoiding false alarms. It
measures the proportion of correctly predicted positive cases out of all the positive predictions
the model made.
3. Recall: Recall, also known as sensitivity or the true positive rate, tells us how well the model can
correctly identify all positive instances in the dataset. It shows how effectively the model avoids
missing positive cases.
4. F1 Score: The F1 score is a special metric that combines precision and recall. It’s especially helpful
when you’re dealing with datasets where one class greatly outnumbers the other. This metric
balances the trade-off between false positives and false negatives.
EXERCISE
A. MULTIPLE CHOICE QUESTIONS
1. _______________ is defined as the percentage of correct predictions out of all the observations.
2. ______________________ is defined as the percentage of true positive cases versus all the cases
where the prediction is true.
4. The result of comparison between the prediction and reality is recorded in the __________________.
186 | P a g e
7. Which of the following comes under Problem Scoping?
9. The _________________ block helps you in analyzing the stakeholders of the project.
10. The ______________ block will help in looking into the situation in which the problem arises, the
context of it, and the locations where it is prominent.
11. ________________ is the one on which we train and fit our model basically to fit the parameters
whereas only to assess performance of the model. is used
1. Define
5. What should be the value of F1 score if the model needs to have 100% accuracy?
187 | P a g e
6. What is a confusion matrix? What is it used for?
7. Imagine that you have come up with an Al based prediction model which has been deployed on the
roads to check traffic jams. Now, the objective of the model is to predict whether there will be a traffic
jam or not. Now, to understand the efficiency of this model, we need to check if the predictions which
it makes are correct or not. Thus, there exist two conditions which we need to ponder upon: Prediction
and Reality. Traffic Jams have become a common part of our lives nowadays. Living in an urban area
means you have to face traffic each and every time you get out on the road. Mostly, school students opt
for buses to go to school. Many times, the bus gets late due to such Jams and the students are not able
to reach their school on time. Considering all the possible situations, make a Confusion Matrix for the
above situation.
8. Create a 4W Project Canvas for the following: As more and more new technologies get into play, risks
will get more concentrated into a common network. Cybersecurity becomes extremely complicated in
such scenarios and goes beyond the control of firewalls. It will not be able to detect unusual activity and
patterns including the movement of data. Think how Al algorithms can scrape through vast amounts of
logs to identify susceptible user behaviour. Use an Al project cycle to clearly identify the scope, how you
will collect data, model and evaluation parameters.
9. Now that you have explored various types of graphs and have already chosen the best ones to plot
your data features, let's draw them out. Select any two data features and plot their graphs using the
website https://datavizcatalogue.com The graph should relate to the goal of your Al project.
(a) Draw the concerned graph on a chart paper and present it to the class.
(b) List down the following points too on the chart paper
(ii) Why have you chosen this representation to depict your data features?
C. SUBJECT ENRICHMENT
Watch the following video for understanding the confusion matrix with the help of an example and then
discuss it in the class.
https://www.youtube.com/watch?v=8Oog7TXHvFY
D. ASSESSMENT
Try these
1. The Intelligent Plece of Paper shows how a program can play the game of Tic-Tac-Toe and win by
following straightforward rules. The instructions of the game can be found
https://www.crazygames.com/game/tic-tac-toe
188 | P a g e
2. Rock paper scissors is a hand game usually played between two people, in which each player
simultaneously forms one of three shapes with an outstretched hand. These shapes are "rock", "paper",
and "scissors". See how the computer is thinking https://rockpaperscissors.ai/
E. KNOWLEDGE HUB
https://urbact.eu/toolbox-home/analysing-problems/4ws
https://suryamaddula.medium.com/the-ai-project-cycle-e363ce3f4f6f
https://aiforkids.in/class-10/evaluation/
F. EXPERIENTIAL LEARNING
https://youtu.be/CcnkmA28qM8
189 | P a g e
Module 13: Functions
Functions are reusable blocks of code that perform specific tasks. They help make programs more
organized and modular by allowing you to define a sequence of steps that can be executed whenever
you need it, without rewriting the code. Functions also make code more readable and efficient,
especially when dealing with complex tasks or repetitive actions.
• Code reusability: Functions allow you to reuse code instead of writing the same code multiple times.
• Modularity: Functions break down complex tasks into smaller, more manageable parts. This makes
code easier to understand and maintain.
• Improved efficiency: Functions make programming more efficient by reducing code repetition.
• Easier debugging: Functions make code easier to reason about and debug.
• Improved readability: Functions make code more readable and organized.
• Easier tracing: It's easier to trace a Python program that's divided into multiple functions.
1. Built-in Functions: Python includes many functions by default, like print(), len(), and max(), which
perform common tasks.
2. User-Defined Functions: These are functions you create to solve specific problems or make your
code more modular and readable.
3. Lambda (Anonymous) Functions: Lambda functions are short, one-line functions defined without a
name (using the lambda keyword). They are often used for simple, quick operations within other
functions or statements.
1- Built in function:
The Python built-in functions are defined as the functions whose functionality is pre-defined in
Python. The python interpreter has several functions that are always present for use. These
functions are known as Built-in Functions. There are several built-in functions in Python which are
listed below:
A. abs(): abs() function is used to return the absolute value of a number. It takes only one argument,
a number whose absolute value is to be returned.
Example: floating = -20.83
print('Absolute value of -40.83 is:', abs(floating))
190 | P a g e
B. sum(): sum() function is used to get the sum of numbers of an iterable, i.e., list.
C. Eval(): eval() function parses the expression passed to it and runs python expression(code) within
the program.
Example: x = 8
print(eval('x + 1'))
Output: 9
D. Float(): The float() function returns a floating-point number from a number or string.
E. Len(): The len() function is used to return the length (the number of items) of an object.
191 | P a g e
H. Round(): The round() function rounds off the digits of a number and returns the floating point
number.
Example:
# for integers
print(round(10))
# even choice
print(round(6.6))
Output:
10
11
7
I. Type(): The type() returns the type of the specified object if a single argument is passed to the
type() built in function. If three arguments are passed, then it returns a new type object.
class Python:
a=0
InstanceOfPython = Python()
print(type(InstanceOfPython))
Output:
<class 'list'>
<class 'dict'>
<class '__main__.Python'>
A UDF (user-defined function) is a function written by a user, typically to implement a feature function.
192 | P a g e
5. The name of function should not be a keyword in Python.
6. We can use an underscore to separate more than one word. For example, function_name(),
person_name(), etc. It improves the readability and maintains conventions.
7. There should not be any space between the two words.
Syntax:
1. Definition and Usage: A function is defined using the def keyword, followed by a name, parentheses
(), and a colon:. Inside the function, you add the code you want to execute when the function is
called.
2. Parameters and Arguments: Functions can take inputs, known as parameters, to make them more
flexible. When you call the function, you pass in arguments (the actual values) that the function uses
to complete its task.
3. Return Values: A function can return a value using the return keyword. This lets you save and use
the output of a function elsewhere in your program.
Defining Function:
The following example shows how to define a function. The bracket is empty so there aren't any
parameters. Here, the first line is a docstring.
def my_function():
print("Hello from a function")
193 | P a g e
• The beginning of a function header is indicated by the keyword def. The function_name is the unique
name given to the function, allowing us to identify and call it later in the program. Function names
in Python follow the same rules as variable names.
• Parameters allow us to pass values into the function when it is called, but they are optional. A colon
(:) signifies the end of the function header.
• A docstring, which is a brief description, can be added to explain the function’s purpose.
• The function’s body contains several valid Python statements, all indented to the same level, usually
by four spaces.
• The return statement can be used to send a value back from the function.
Function Calling:
Defining a function only gives it a name, specifies the parameters that are to be included in the function
and structures the blocks of code. Once the basic structure of a function is finalized, you can call it by
using the function name itself. If the function requires any parameters, they should be passed within
parentheses. If the function doesn't require any parameters, the parentheses should be left empty.
def my_function():
print("Hello from a function")
my_function()
#If it doesn’t have to pass any arguments and function is not returning anything
def add(num1,num2):
result=num1+num2
return result
Total= add(5,9)
• The result 5+9=14 is stored in the variable ‘Total’ which is returned by the function
• In the function call add(5,9), the numbers 5 and 9 are called the arguments of the function which
will be mapped to the parameters num1 and num2:
5 → num1
9 → num2
• Then these two numbers are used to compute ‘result=num1+num2’
194 | P a g e
Function Arguments:
Arguments are specified after the function name, inside the parentheses. You can add as many
arguments as you want, just separate them with a comma.
The following example has a function with one argument (fname). When the function is called, we pass
along a first name, which is used inside the function to print the full name:
def my_function(fname):
print(fname)
my_function("Emil")
my_function("Tobias")
my_function("Linus")
Return Values:
def my_function(x):
return 5 *x x
print(my_function(3))
print(my_function(5))
print(my_function(9))
EXERCISE
195 | P a g e
A. MULTIPLE CHOICE QUESTIONS
(a) 3 (b) 4
(c) 4 is maximum (d) None of the mentioned
sayHello()
sayHello()
196 | P a g e
6. Select which is true for Python function.
(a) A function is a code block that only executes when called and always returns a value.
(b) A function only executes when it is called and we can reuse it in a program
(c) Python doesn't support nested function
(d) None of the above
7. Select which is true for Python function
(a) A Python function can return only a single value
(b) A function can take an unlimited number of arguments.
(c) A Python function can return multiple values
(d) Python function doesn't return anything unless and until you add a return statement
8. Python function always returns a value
(a) False
(b) True
9. Which of the following items are present in the function header?
(a) function name
(b) parameter list
(c) return value
(d) Both A and B
10. If return statement is not used inside the function, the function will return:
(a) None
(b) 0
(c) Null
(d) Arbitary value
11. What is a variable defined outside a function referred to as?
(a) local variable
(b) global variable
(c) static Variable
(d) automatic variable
12. How is a function declared in Python?
(a) def function function_name():
(c) def function_name():
(b) declare function function_name():
(d) declare function_name():
13. Which one of the following is the correct way of calling a function?
(a) function_name()
(b) call function_name()
(c) ret function_name()
(d) None of the above
14. You can also create your own functions, these functions are called?
(a) built-in functions
(b) user-defined functions
(c) py function
(d) None of the above
197 | P a g e
B. ANSWER THE FOLLOWING
1. What is the significance of having function in a program?
2. Differentiate between
• Parameters and arguments.
• Built in functions and user defined functions
• Local and global variables
3. Write and explain the types of functions supported by python.
4. Write the syntax of function definition and explain with an example.
5. What does a function return by default in Python?
6. Write a function to
(a) Calculate area and perimeter of a rectangle
(c) Calculate the power of a number raised to the other.
(b) Calculate the area and circumference of a circle
(d) Display whether the user is able to vote or not.
(e) Check whether a number is even or not.
(f) Check if a number is prime or not.
(g) Ask the user to enter one number and then use the function to display the square of it inside the
function without returning any data to the calling script.
(h) Ask the user to enter one number, pass this number to a function, return the number to the
main script after adding 10 to the value.
(i) Ask for two user input numbers, pass to a function and then display the highest number.
(j) To input a number and prints the multiplication table of that number.
7. Given below are some function definitions. Identify which of these are invalid giving reasons.
(a) def product(a,b):
print(a*b)
(b) def product(a+1,b):
print(a*b)
(c) def products(5,'b')
print(a*b)
198 | P a g e
9. What is a Python module? Explain its significance.
• A name inside the parentheses of a function header that can receive a value
• An argument passed to a specific parameter using the parameter name
• A value passed to a function parameter
• A value assigned to a parameter name in the function call
• A variable created inside a function body
C. KNOWLEDGE HUB
https://pynative.com/python-functions/
D. EXPERIENTIAL LEARNING
https://youtu.be/oSPMmeaiQ68
199 | P a g e
Your trusted partner for
Robotics -AI & other Skill
Based Programs
Highlights
A Decade of Experience
Strong R&D team
Structured Curriculum & Relevant Age Appropriate Programs
Trained and Qualified Instructors
Self manufactured tried & tested kits
STEM.org certified