Python for data science and ai Coursera answers
Table of Contents
WEEK 1
Types
1. what is the type of the following: 1
Answer : int
✓ Correct correct, as there is no decimal, the number is of type int
2. what is the result of the following code segment: type(tnt(12.3))
Answer : int
✓ Correct correct, in this code, we first cast or convert the float to an integer, then use the type function to determine the type
3. What is the result of the following code segment: int(12.3)
Answer : 12
✓ Correct Correct, In Python, if you cast a float to an integer, the conversion truncates towards zero.
4. What is the result of the following code segment: Int(True)
Answer : 1
✓ Correct correct, when you cast a Boolean True to an integer you get a 1
Expressions and Variables
LATE ST SUBMISSION GRADE  100%
1. What is the result of the following code segment1/2
Answer : 0
✓ Correct correct // corresponds to integer division
2. What is the value of x after the following lines of code: x=2 x=x+2
Answer : 4
✓ Correct Correct the value x=x+2 changes the value of x. if x is assigned to its self. Its helpful to replace the value of x with is current value in this case 2 or x=2+2.
3. What is the result of the following operation 1+3.2?
Answer : 7
✓ Correct correct. Python follows the standard mathematical conventions
4. In Python 3. what is the type of the variable x after the following: x=1/1
Answer : float
✓ Correct correct. in Python 3. regular division always results in a float
String Operations
LATEST SUBMISSION GRADE  100%
1. In Python, if you executed name = 'Lizz', what would be the output of print(name[0:2])?
Answer : Li
✓ Correct Correct, we only retrieve the first two elements.
2. In Python, if you executed var =111234567', what would be the result of print(var[::2]).
Answer : 0246
✓ Correct Correct, a stride value of 2 selects even elements
3. In Python, what is the result of the following operation: '1'+'2'
Answer : '12'
4. Given myvar = 'hello' , how would you return myvar as uppercase?
Answer : myvar.upper()
✓ Correct correct
5. Consider the string Name="ABCDE", what is the result of the following operation Name.flnd("B")
Answer : 1
%/ Correct correct, the method finds the starting index of a substring
6. what is the result of the following : str(1)+str(1)
Answer : '11'
✓ Correct correct, the integers are cast to a string, and the strings are concatenated
7. what is the result of the following: "123".replace("12", "a b")
Answer : 'ab3'
✓ Correct correct, the method replace returns a copy of the string with all occurrences of the old substring
WEEK 2
List and Tuples
LATEST SUBMSSION GRACE
1. What is the syntax to obtain the first element of the tuple: A=('a','b','c')
Answer : A[0]
✓ Correct correct, the index 0 corresponds to the first element of a list or tuple.
2. Consider the tuple A=011,12),(21,22)). that contains a tuple and list. What is the result of the following operation A[1]:
Answer : (21.22)
✓ Correct correct, the index t corresponds to the second element in the topic which contains another list
3. Consider the tuple A=01112.3L(41). that contains a tuple and list. What is the result of the following operation A[2][0]
Answer : 4
✓ Correct correct. A(2) corresponds to the third nested list we then access the only element of the list using the index 0 i.e. AI21(01.
4. What is the result of the following operation: '1,2,3,4.split(',')
Answer : ['1','2','3','4']
5. The method append does the following:
Answer : adds one element to a list
✓ Correct correct. appendonly adds one element.
6. What is an important difference between lists and tuples?
Answer : Lists are mutable tuples are not
✓ Correct correct, lists are mutable tuples are not
7. consider the following list :A=[hard rock",10,1.2]
what will list A contain ether the following command is run: delA[1])
Answer : ['hard rock',1,2]
8. if A is a list what does the following syntax do: B=A[:]
Answer : variable B references a new copy or clone of the original list A
9. what is the result of the following len(rdisco",10,1.2. 'hard rock",10))
Answer : 5
WEEK 3
Python for data science and ai Coursera answers
Python for data science and ai Coursera answers
Python for data science and ai Coursera answers
Python for data science and ai Coursera answers
Python for data science and ai Coursera answers
Python for data science and ai Coursera answers
Python for data science and ai Coursera answers
Python for data science and ai Coursera answers
Ignore tags:
python for data science and ai,  
python for data science,  
IBM Data Science Professional Certificate,  
python for data science and ai answers,  
python for data science and ai quiz answers,  
python for data science and ai coursera,  
python for data science and ai coursera answers,  
python for data science and ai week 5 assignment,  
python for data science and ai week 5,  
python for data science and ai coursera peer graded assignment,  
data science,  
coursera solutions,  
Coursera,
,python for data science and ai github python for data science and ai ,, week 5 assignment answers edx python basics for data science ,,final assignment answers ibm data science professional certificate ,, github solutions pythonfor data science and ai coursera answers ,, github python for data science and ai peer graded assignmentsolution ,

Also read : Flower Sequence solution codechef 2021