This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests_with_caching | |
import json | |
def get_movies_from_tastedive(title): | |
url = 'https://tastedive.com/api/similar' | |
param = {} | |
param['q']= title | |
param['type']= 'movies' | |
param['limit']= 5 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. The variable nested contains a nested list. Assign ‘snake’ to the variable output using indexing. | |
nested = [['dog', 'cat', 'horse'], ['frog', 'turtle', 'snake', 'gecko'], ['hamster', 'gerbil', 'rat', 'ferret']] | |
output = nested[1][2] | |
print(output) | |
# 2. Below, a list of lists is provided. Use in and not in tests to create variables with Boolean values. | |
# See comments for further instructions. | |
lst = [['apple', 'orange', 'banana'], [5, 6, 7, 8, 9.9, 10], ['green', 'yellow', 'purple', 'red']] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. The textfile, travel_plans.txt, contains the summer travel plans for someone with some commentary. | |
# Find the total number of characters in the file and save to the variable num. | |
fileref = open("travel_plans.txt","r") | |
num = 0 | |
for i in fileref: | |
num += len(i) | |
fileref.close() | |
# 2. We have provided a file called emotion_words.txt that contains lines of words that describe emotions. |