Cookie Consent by Free Privacy Policy Generator Data Processing Using Python Week 2 Quiz Answers - Coursera!

Data Processing Using Python complete course is currently being offered by Nanjing University through Coursera platform and is being taught by ZHANG Li.

About this Course

This course, as a whole, based on Finance data and through the establishment of popular cases one after another, enables learners to more vividly feel the simplicity, elegance, and robustness of Python. Also, it discusses the fast, convenient and efficient data processing capacity of Python in humanities and social sciences fields like literature, sociology and journalism and science and engineering fields like mathematics and biology, in addition to business fields. Similarly, it may also be flexibly applied into other fields.

Skills You Will Gain

  • Python Programming
  • Numpy
  • Pandas
  • Wxpython

Also Check: How to Apply for Coursera Financial Aid

Data Processing Using Python Week 2 Quiz Answers - Coursera!

Data Acquisition and Presentation Quiz Answers

Question 1) Of the following “open” statements, which one can NOT delete or modify the contents in the text file “test.txt”?
  • fp = open('test.txt', 'r+')
  • fp = open('test.txt', 'w')
  • fp = open('test.txt', 'a')
  • fp = open('test.txt', 'r')

Question 2) Because of using the buffer OS will cache the data instead of writing them into the disk immediately When calling  write() to write text files using open(). Part of data may be lose before writing into the disk if you don’t process it properly. 
  • T
  • F

Question 3) We often use the “request” library to fetch webpages, the “Beautiful Soup” library and the “re” module to parse the webpage contents.
  • T
  • F

Question 4) For the sequence: numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], which of the following relevant operation and corresponding output is correct?

>>> numbers[0: 2]
[1, 2, 3]

>>> numbers[-2:]
[9, 10]

>>> numbers[: -1]
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

>>> numbers[0::3]
[1, 3, 5, 7, 9]

Question 5) Which is the correct output result among the following relevant operations of sequence?

>>> [5] * 2 
[10]

>>> print('Merry Xmas ' + 12.25)
Merry Xmas 12.25

>>> word = 'cloud'; print(min(word))
c

>>> word = 'cloud'; word[5]
'd'

Question 6) Which of the following relevant operations of list have correct output results?

>>> language = list('PHP')
>>> language[1:] = 'ython' 
>>> print(language)
['P', 'y', 't', 'h', 'o', 'n']

>>> x = [2, 3, 0, 4, 1]
>>> x.sort()
>>> print(x)
[0, 1, 2, 3, 4]

Question 7) Please decide whether the following statements are true or false.
All standard sequence operations, like slice indexes, are applicable to strings. However, strings are all immutable. Pay attention not to assign to slice data.
  • T
  • F

Question 8) For the following relevant operations of strings, which are the correct output results?

>>> print('you' in 'Life is short, you need Python.')
True

>>> 'Life is short, you need Python.'.find('you') 
15

Question 9) What’s the result of the following statement: (1, 2) in zip(range(4), range(2,6))
  • False

Question 10) If the follow code snippet wants to access the response "r" in text format, what shall be filled in the blank.

r = requests.get(url)
soup = BeautifulSoup(________, 'lxml')

  • r.encoding
  • r.content
  • r.text
  • r.read

Question 11) Fill in an appropriate math operator so that the list comprehension statement "[ x_____ 2 for x in range(5)]" will generate [0, 1, 4, 9, 16].
  •  ** 

Question 12) Suppose a text file "test.txt" exists in the current directory and its content is as below:
Life is short, you need Python. 
Simple is better than complex.

Which of the following will be the result of the following code snippet?

with open('test.txt', 'r+') as fp:
    fp.seek(15)
    print(fp.readline())

  • Simple is better than complex.
  • you need Python.
  • Result will be empty
  • Life is short, you need Python.

Question 13) Which of the following is the result of the code snippet below?

my_list = [s.lower() for s in 'Life is short, you need Python.'.split(' ')]
print('short' in my_list)
print(my_list[5])

  • True  Python
  • True  python.
  • False  python.
  • False  Python

Question 14) Given two lists – "name" and "score". Each of them has 10 elements respectively. All elements in "name" are strings while all elements in "score" are integers. Any element in "name" maps to the same position in "score". Now please fill in with(Please separate each value of the result in a semicolon) format operators in the incomplete code snippet below to print this way:"2-digit integer, up to 8 characters: 3-digit integer". For example:

5,Jacky   : 90

for i in range(10):
    print('{:____},{:____}:{:____}'.format(i, name[i], score[i]))

Answer:_______________

Question 15) Which of the following statement can display the names of all functions provided by "str"?

Post a Comment

Previous Post Next Post