An introduction to curl using GitHub's API
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/cibofdevs
| # 1. Create a function called mult that has two parameters, the first is required and should be an integer, | |
| # the second is an optional parameter that can either be a number or a string but whose default is 6. | |
| # The function should return the first parameter multiplied by the second. | |
| def mult(a, b=6): | |
| return a * b | |
| # 2. The following function, greeting, does not work. Please fix the code so that it runs without error. | |
| # This only requires one change in the definition of the function. |
| # 1. Write code to assign to the variable map_testing all the elements in lst_check | |
| # while adding the string "Fruit: " to the beginning of each element using mapping. | |
| lst_check = ['plums', 'watermelon', 'kiwi', 'strawberries', 'blueberries', 'peaches', 'apples', 'mangos', 'papaya'] | |
| map_testing = map(lambda str: "Fruit: " + str, lst_check) | |
| # 2. Below, we have provided a list of strings called countries. | |
| # Use filter to produce a list called b_countries that only contains the strings from countries that begin with B. | |
| countries = ['Canada', 'Mexico', 'Brazil', 'Chile', 'Denmark', 'Botswana', 'Spain', 'Britain', 'Portugal', 'Russia', 'Thailand', 'Bangladesh', 'Nigeria', 'Argentina', 'Belarus', 'Laos', 'Australia', 'Panama', 'Egypt', 'Morocco', 'Switzerland', 'Belgium'] |
| # 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']] |
| 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 | |
Error The attempted operation is not supported for the type of object referenced when using virtual network adapter on wsl2
Try run this commands:
wsl --shutdown
netsh winsock resetIf execution success, The message like this: