What will be the output after the following code is executed…
What will be the output after the following code is executed and the user enters 75 and -5 at the first two prompts?try: tot_cost = float(input(‘Enter total cost of items: ‘)) num_items = int(input(‘Enter number of items: ‘)) avg_cost = tot_cost / num_items except ZeroDivisionError: print(‘ERROR: Number of items cannot be zero!’) except ValueError: print(‘ERROR: Number of items cannot be negative!’) else: print(‘There were no run-time errors!’) finally: print(‘We are finally done with this!’)
Read DetailsOPTIONAL Currently, there’s been quite a bit of discussion a…
OPTIONAL Currently, there’s been quite a bit of discussion about the causes of autism. There is some evidence of an association between taking Tylenol during pregnancy, and the later development of autism in a child. First, tell me what type of correlation this is and why. Next, tell me why arriving at the conclusion that Tylenol causes autism is questionable at best.
Read DetailsA movie rental company has a rentals table with columns movi…
A movie rental company has a rentals table with columns movie_id, genre, and rental_fee. The finance team wants to find genres that generated more than $50,000 in total rental fees. Which query should they use? SELECT genre, SUM(rental_fee) FROM rentals GROUP BY genre HAVING SUM(rental_fee) > 50000 SELECT genre, SUM(rental_fee) FROM rentals WHERE SUM(rental_fee) > 50000 GROUP BY genre SELECT genre, rental_fee FROM rentals GROUP BY genre WHERE rental_fee > 50000 SELECT genre, SUM(rental_fee) FROM rentals ORDER BY SUM(rental_fee) > 50000 Answer: SELECT genre, SUM(rental_fee) FROM rentals GROUP BY genre HAVING SUM(rental_fee) > 50000 Explanation: The HAVING clause is required to filter aggregated totals. WHERE can’t filter on SUM, and ordering doesn’t filter results.
Read Details