Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
def sw_vehicle_search(cargo_capacity: int, max_speed: int, cost: int) -> list:
This function will use the https://swapi.dev/ API to collect its information. This function is meant to be used to search for vehicles in Star Wars that meet the specified criteria. The function should return a list of names of the vehicles that have cargo capacities and a max speed greater than or equal to the value specified but also cost less than or equal to the cost given. Vehicles with "unknown" or "none" for any of the mentioned categories should not be regarded.
Keep in mind that not all of the vehicles in star wars are returned in one request to https://swapi.dev/api/vehicles/. The JSON object returned by this request has a next attribute that represents the next page of information. You must make multiple requests for each page to collect all vehicle information.
You might find it helpful to use the following API handle(s):
https://swapi.dev/api/vehicles/ - to retrieve all vehicles in Star Wars
def starship_piloted_species(starship: str) -> list:
This function will use the https://swapi.dev/ API to collect its information. This function will be given a string that represents the name of a starship in star wars. It should return a list of names of species that have piloted the specified starship. The order of the list does not matter. If the pilot's species is empty, then the pilot is considered a "Human".
You might find it helpful to use the following API handle(s):
https://swapi.dev/api/starships/ - to retrieve all starships in Star Wars
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 2 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- In Rarrow_forwardPython code please help, indentation would be greatly appreciatedarrow_forwardJS Write a function named number_of_pairs whose parameter is an object/dictionary with strings as keys and integers as values. Your function should returns the number of key-value pairs in the parameter.arrow_forward
- Filename: runlength_decoder.py Starter code for data: hw4data.py Download hw4data.py Download hw4data.pyYou must provide a function named decode() that takes a list of RLE-encoded values as its single parameter, and returns a list containing the decoded values with the “runs” expanded. If we were to use Python annotations, the function signature would look similar to this:def decode(data : list) -> list: Run-length encoding (RLE) is a simple, “lossless” compression scheme in which “runs” of data. The same value in consecutive data elements are stored as a single occurrence of the data value, and a count of occurrences for the run. For example, using Python lists, the initial list: [‘P’,‘P’,‘P’,‘P’,‘P’,‘Y’,‘Y’,‘Y’,‘P’,‘G’,‘G’] would be encoded as: ['P', 5, 'Y', 3, ‘P’, 1, ‘G’, 2] So, instead of using 11 “units” of space (if we consider the space for a character/int 1 unit), we only use 8 “units”. In this small example, we don’t achieve much of a savings (and indeed the…arrow_forwardDefine the function lake_to_tli3_dict(readings) that takes a list of (lake_name, chla, tn, tp) tuples and returns a dict mapping lake names to trophic level index values. That is, the keys are lake names and the values will be TLI3 values. Notes: You will need to have import math as your first line of code. You must include and use/call the trophic_level_index function that you wrote in Question 1. trophic_level_index must still work as specified in Question 1. Lakes should be added to the dictionary in the same order as they appear in the readings list. If a lake appears in the readings list more than once, then the TLI for the last occurrence in the readings list should be the one that appears in the result. (This should happen naturally, since the lake name can only occur in the dictionary once.) For example: Test Result names_cnp_1 = [('Lake Brunner', 0.8, 218.0, 6.0), ('Lake Carrot', 5.1, 505.0, 18.5) ] tli3_dict = lake_to_tli3_dict(names_cnp_1 ) print(tli3_dict)…arrow_forwardThis code is a part of a C dictionary. Please write the code for the below requirements. dict_get Next, you will implement: char* dict_get (const dict_t* dict, const char* key); This function goes through the list given by dict. If you use the above structure, this means starting at el = dict->head and checking each time whether the key at el is key; if it is not, we set el = el->next, until either key is found, or we reach el == NULL. To compare key with el->key, we need to compare one by one each character in key with those in el->key. Remember that strings in C are just pointers (memory addresses) to the first character in the string, so comparing el->key == key will not do what you want. So how do you even get the length of a string s? You would start at memory location s and advance as long as the byte at s (i.e. *s) is not the end-of-string marker (\0, the NULL character). This can get a bit messy, so luckily, you are allowed to use the string comparison…arrow_forward
- python pleasearrow_forward+|| 8 Exercise 1 (2%) Create an anonymous block that displays a course list. Declare a cursor and use the OPEN,FETCH, and CLOSE cursor statements to access the cursor. Use the %ROWTYPE attribute for the cursor. Output: Course Code Course Title Accounting Theory Microeconomics Financial Accounting Anthropology Introduction to Business Businéss Planning Web Technologies I Programming Logic Web Technologies II Python Programming Web Technologies III Database Design & SQL Communications I ACC104 ACC205 ANT100 BUS100 BUS230 CIS100 CIS105 CIS200 CIS225 00ESI) CIS400 ENG101 ENG201 GEO101 MGT410 Communication II The Physical Environment Human Resources Management Project Management Algebra Geometry Nursing Theory I Nursing Theory II MGT415 MTH120 MTH400 NSG130 NSG230 -19°C Mostly sunny ^ o prt sc home end insert delete F6 F7 F10 F11 F12 81 ) ( num backspace lock 6 } { ] enter 7. shift B. / dn 6d up 6d alt ctrl >arrow_forwarddef my_index_1(my_list:List[int], my_element:int)->int:"""Our version of the one-argument version of the index function.https://docs.python.org/dev/library/stdtypes.html#common-sequence-operations)This function takes a list and an element, and returns the smallestindex where the element occurs in the list. This function returnsNone if the element is not in the list.Arguments:my_list (list): A list of integers.my_element (int): The element to be found.Returns:int: The smallest index at which my_element is found in my_list.Examples:>>> print(my_index_1([], 2))None>>> print(my_index_1([1, 2, 3], 2))1>>> print(my_index_1([3, 1, 2, 3, 1], 2))2>>> print(my_index_1([3, 1, 2, 3, 1], 3))0""" Please solve this in Pythonarrow_forward
- As part of this assignment, the program that you will be writing will store current grades in a dictionary using course codes as keys and with values consisting of percent grades in lists. The main functions of this program are to print a student's gradebook, to drop the lowest grade in each course, print the student's gradebook again, drop the course with lowest average, and finally printing the student's gradebook again. This program requires a main function and a custom value-returning function. In the main function, code these basic steps in this sequence (intermediate steps may be missing): start with an empty dictionary that represents a gradebook and then use a while loop to allow the input of course codes from the keyboard. End the while loop when the user presses enter without entering data.within the while loop:for each course entered, use a list comprehension to generate five random integers in the range of 70 through 100. These random integers in a list represent the…arrow_forwardPyhton code please help, indentation would be greatly appreciatedarrow_forwardJS Write a function named sum_between_indices whose parameter is a list/array of decimal numbers. Your function must return the sum of the entries at index 4 through index 15. Make certain to include the entries at index 4 and at index 15 in your sum. You SHOULD assume the parameter will have more than 15 entries.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education