Skip to content

Instantly share code, notes, and snippets.

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
# 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']]
# 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.