0% found this document useful (0 votes)
2 views16 pages

Computational Thinking & AI

The document discusses the use of Python in artificial intelligence, particularly in solving complex problems at an Antarctic base, highlighting its simple syntax and powerful libraries. It explains various types of loops in Python and introduces heuristics as a method for making quick decisions, providing examples and advantages of using heuristics. Additionally, it includes questions and answers related to Python programming and heuristics.

Uploaded by

Ahmad Alagha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views16 pages

Computational Thinking & AI

The document discusses the use of Python in artificial intelligence, particularly in solving complex problems at an Antarctic base, highlighting its simple syntax and powerful libraries. It explains various types of loops in Python and introduces heuristics as a method for making quick decisions, providing examples and advantages of using heuristics. Additionally, it includes questions and answers related to Python programming and heuristics.

Uploaded by

Ahmad Alagha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

Computational thinking:

Artificial intelligence

Unit 1: Antarctic base

Grade 9

P (60-65)
Python
Python is a versatile, high-level programming language known for its
simple syntax, making it easy to learn and use. It is widely used for
web development, data analysis, artificial intelligence, automation,
and more.

Python is often used to develop AI systems and tools, making it ideal


for solving complex problems like those faced at an Antarctic base,
such as weather prediction. Resource management, and automation.
Its libraries like TensorFlow and NumPy enable creating AI models to
analyze data and make intelligent decisions in extreme
environments.
Traverse the list of signals
Python supports the following types of loops to help repeat code
execution:
1- for Loop (Used to iterate over a sequence (like a list, tuple, string,
or range).

for i in range(5):
print(i)
# Output: 0, 1, 2, 3, 4
2- while Loop (Repeats as long as a condition is True).

x = 0 while x < 5:
print(x)
x += 1
# Output: 0, 1, 2, 3, 4
3- Nested Loops (You can place a loop inside another loop).

for i in range(3):
for j in range(2):
print(f"i={i}, j={j}")
4- Additional Features:
for i in range(10):
if i == 5:
break
print(i)
# Output: 0, 1, 2, 3, 4

for i in range(5):
if i == 2:
continue
print(i)
# Output: 0, 1, 3, 4
for i in range(5):
print(i)
else: print("Loop completed!")
# Output: 0, 1, 2, 3, 4, Loop completed!
Artificial intelligence:
- Or AI means building computers that can solve problems using human-like judgement.

Methods:

 Heuristics
 Expert systems
 Decision trees
 Machine learning
Computational thinking:
Artificial intelligence

Unit 1: Heuristics

Grade 9

P (66-69)
Heuristics
A heuristic is a rule that helps you make a quick decision. It’s like a guess or a rough
estimate. But it is a guess based on careful thinking about the problem.
Heuristics are not always completely accurate. But they provide a quick way to simplify
difficult problems.

- People judge the likelihood of an event based on how easily examples come to mind.
Example: After hearing about a plane crash on the news, you might overestimate the risk of
flying, even though statistically, it's much safer than driving.

- Decisions are made based on how similar something is to a prototype in a person’s mind.
Example: Assuming someone wearing a lab coat is a doctor because they fit the stereotype,
even if they are actually a scientist.

- People rely heavily on the first piece of information they encounter when making decisions.
Example: A salesperson starts with a high price and offers a discount; customers might feel
they’re getting a deal, even if the final price is still expensive.
The heuristic we will use:
- Signals with fewer than three characters are bad.
- None of the good signals are this short.
- They will be excluded from the list.

if len (item) < 2:


The heuristic has made a list of good signals, without any input from the user.
OUTPUT:

- Many of the bad signals have been removed from the list.
- All the good Signals are still on the list.
- Some bad signals are still on the list. The heuristic did not find them.

Check Advantages & disadvantages of heuristics: Page 69


Questions:
1) How do you add an item to a list? my_list my_list .append print(my_self)
2) What does the following heuristic filter out?
List = [“abc", “xyz00", “P1000", "gr"]
for item in List:
if len(item) >4:
print(item)
Answer: items shorter than 4 characters

3) What will be the output of this code?


numbers = [1100, 150, 9099, 999]
num = [ ]
for item in numbers:
if item > 1000:
num.append(item)
print(num) Answer: num = [ 1100, 9099]
Questions:
4) What does the following code do?
numbers = [100, 200, 300]
for i in range(len(numbers)):
print(my_list[i] / 2)
Answer: Divides each number by 2 and prints it.

5) Which statement correctly traverses all elements in a list called “words”?


Answer: for item in words:

6) Which function is used to find the length of a list in Python?


Answer: len( )

7) What will be the output of the following code?


my_list = [“abc", “xyz", “qoq“ , “hfhf”]
print(my_list[2])
Answer: qoq

8)What will happen if you try to access numbers[3] when numbers = [0 , 1]?
Answer: It will give an error

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy