Professional Documents
Culture Documents
Mujtaba-Iot-014 - Colaboratory
Mujtaba-Iot-014 - Colaboratory
ipynb - Colaboratory
freind_details=["ali", 20 , "engeneer"]
print(freind_details)
movies =[
("the god father , 1972")
("the fight club" , 1998)
("the pulp fiction" , 2002)
]
for movie in movies:
movie name .= input ("enter the name of the movie:")
movie_year = int(input("enter the release year of the move:"))
new_movie = (movie name , movie_year)
movies.append(new_movies)
print(f"movie:{movie[0]}, release year: {movie[1]}")
DICTIONARY IN PYTHON; \The dictionary is an unordered collection that contains key:value pairs separated by commas inside curly brackets.
DICTIONARY EXAMPLE:
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
def add_numbers(a,b):
result=a+b
return resultsum_result = add_numbers(5,3)
print(sum_result)
LAB 02 OCTOBER
def vacuum_cleaner(percept):
location = percept['location']
status = percept[location]
#update the model based on current percept
model['A'] = status
if status == 'DIRTY':
print(f"SUCKING UP DIRT AT {location}")
https://colab.research.google.com/drive/1ws6tIPNSrZ7aAYgm7JJ3WydOXrkxfR-d#scrollTo=GQBkodEUH5AJ&printMode=true 1/2
10/2/23, 1:01 PM Untitled1.ipynb - Colaboratory
environment[location] = 'CLEAN'
else:
print("MOVING TO ANOTHER LOCATION")
if location == 'A':
environment['location'] = 'B'
else:
environment['location'] = 'A'
for _ in range(5):
print("PERCEPT:", environment)
vacuum_cleaner(environment)
print("\n use of model",model)
https://colab.research.google.com/drive/1ws6tIPNSrZ7aAYgm7JJ3WydOXrkxfR-d#scrollTo=GQBkodEUH5AJ&printMode=true 2/2