How is a code block, for example a function, in python defined? begin and end statements indentation opening and closing of curly braces ("{}") opening and closing of parentheses("()") Question 2 In a...

1 answer below »
Please ignore the APA reference, I was required to answer something for reference field. Please answer the questions in the attached file. For questions asking for code, please be sure to confirm that the code works before typing an answer. Please review and confirm all of the questions that I have answered already as well. Thanks!


How is a code block, for example a function, in python defined?  begin and end statements indentation opening and closing of curly braces ("{}") opening and closing of parentheses("()")   Question 2 In a social media analytics application, we aim to create a lookup table connecting the Twitter handle with the user id of the account. The most efficient data structure to use in this situation is: a tuple a string a dictionary a list   Question 3 Assume you are given a file containing a trillion records. While inbuilt data structures in Python (e.g., lists, dictionaries) are efficient, why is it a bad idea to load a trillion records into a data structure and perform any necessary computations? Answer in a tweet or less (140 characters)!   Question 4 You can have your DNA sequenced nowadays from services like 23andMe. Given your DNA sequence, we aim to look for occurrences of specific motifs (patterns) , indicating propensity for inheritance of certain diseases. Which inbuilt Python method would you use to find occurrences of the motifs and their locations? For instance, a DNA sequence could be "ACGTGCTA..." and a motif could be "TGC". Just specify the method, no implementation necessary.   Question 5 The following code snippet causes errors.  a = "CS" b = 5644 print(a + b + " is awesome!") How will you fix the last line so it prints "CS5644 is awesome!" Provide the corrected line of code in your answer. Only the last line should be changed. Other lines should be unmodified. No extra lines need to be added.   Question 6 You are given a list of numbers and there might be duplicates in it. How will you eliminate the duplicates without using loops explicitly? (Hint: Think of how a list can be transformed to other data types)   Question 7 Given a dictionary of companies and their ticker symbols: companies = {'google':'GOOGL', 'facebook':'FB', 'apple':'AAPL', "microsoft":"MSFT"} Write a code snippet to print all (and only) the ticker symbols from the dictionary. Each ticker symbol should appear in a new line.   Question 8 If we were to try to ascertain the correlation between two variables in a dataset, what kind of plot would we use? Scatter Plot Histogram Bar Graph Stacked Histogram   Question 9 How would you use numpy to generate 500 samples from a Gaussian (normal) distribution with mean 3 and standard deviation 5 in python? Hint:  import numpy as np gaussian_vals = #your code here.   Question 10 You are given a dataset containing power consumption values for a set of many of households over a 3 month period. Your goal is to try to understand the general trend of daily power consumption (by hour) on average across the different households. Which of the following kinds of plots would be the best fit for such a visualization? Histogram Stacked Histogram Line Graph Box Plot
Answered Same DaySep 15, 2021

Answer To: How is a code block, for example a function, in python defined? begin and end statements indentation...

Vibhav answered on Sep 15 2021
143 Votes
1. Code block in python is defined by indentation, for example a function. So second option is correct.
2. A dictionary is an appropriate data structure for this. So, correction option is third option. Dictionary stores data in key, value pairs. It is easy to look up values from dictionary for associated values of keys.
3. Reading records from a file and storing in a variable consumes the main memory of the computer. So, if we want to read and store the entire file containing a trillion...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here