5. Python Fundamental-Data Structure
5. Python Fundamental-Data Structure
print (symptoms)
print (symptoms)
Resul ['fever', 'cough', 'headache', 'sore throat', 'loss of taste or
t smell', ['Runny Nose', 'dearrha', 'sleepy']]
Lists…
9Check if Item Exists To determine if a specified item is present in a
list use the in keyword:
Example 1: Check if "apple" is present in the list:
daily_cases = [15, 22, 30, 28, 35, 40, 38] # Daily new cases
total_cases = sum(daily_cases) # Calculate the total number
of cases
Resu Cherry
lt ('cherry', 'orange', 'kiwi')
Python Dictionaries
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
print(thisdict["brand"])
Resu Ford
lt
Python Dictionaries
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
"year": 2020
}
print(thisdict)
my_set = {1, 2, 3, 4}
print(my_set)
Recap
https://www.w3schools.com/python/
https://www.tutorialspoint.com/python/
https://www.learnpython.org/
20 .
21
Data Access and Sharing Policy