IBM Python For Data Science Questions And
Correct Answers
what's the diff btwn / and // in python? ANSWER the single one always result in float
while double slash result in integer
run code in Jupyter ANSWER Shift + enter
import sys
print(sys.version) ANSWER Find which version of python u are using in jupyter
sys is a module which includes lots of system specific parameters and functions
including Python version being used. Before using it. - ANSWER we must explicitly
import it.
In python to write comments use the. symbol - ANSWER hash
The. message in tells you: 1. where the error occurred (more useful in large notebook
cells or scripts), and 2. what kind of error it was (NameError) - ANSWER
error.message in python
Python is what is called an,,,,,,,,,,,,,language. Compiled languages examine your entire
program at compile time, and are able to warn you about a whole class of errors prior to
execution. Instead, Python reads your script line by line when it runs your program.
Python will then terminate the execution of the whole program in case of finding an error
this is, if that error is an unexpected one - and hence, not handled - by the programmer,
something that we'll consider in more advanced detail later on during the course. -
ANSWER interpreted language
Object-oriented Python language
, There are many different types of objects in Python.such as - ANSWER strings,
integers and floats.
strings, integers and floats. float(x) does what - ANSWER cast x to flot
Convert string to integer - ANSWER int('1')
String, we can index string using numbers Musa[1] - ANSWER indexing
Replicate String = 3* Names - ANSWER NamesNamesNames
Names.Find('isa').find substring. - ANSWER the method finds starting index of a
substring
Find number of character : len("Michael Jackson") - ANSWER find length of charcter
Slicing : We can get more than one characters in a string by slicing. NAME = "TIJJANI"
○ - ANSWER NAME[0:4] = TIJJ
Concatenate String IN PYTHON - ANSWER Statement = Name + "is the best"
replace the old substring with the new target substring is the segment has been found in
the string
A = "Michael Jackson is the best"
B = A.replace('Michael', 'Janet') - ANSWER Replace method:
find the first index of the sub-string - ANSWER G.find('snow')
Correct Answers
what's the diff btwn / and // in python? ANSWER the single one always result in float
while double slash result in integer
run code in Jupyter ANSWER Shift + enter
import sys
print(sys.version) ANSWER Find which version of python u are using in jupyter
sys is a module which includes lots of system specific parameters and functions
including Python version being used. Before using it. - ANSWER we must explicitly
import it.
In python to write comments use the. symbol - ANSWER hash
The. message in tells you: 1. where the error occurred (more useful in large notebook
cells or scripts), and 2. what kind of error it was (NameError) - ANSWER
error.message in python
Python is what is called an,,,,,,,,,,,,,language. Compiled languages examine your entire
program at compile time, and are able to warn you about a whole class of errors prior to
execution. Instead, Python reads your script line by line when it runs your program.
Python will then terminate the execution of the whole program in case of finding an error
this is, if that error is an unexpected one - and hence, not handled - by the programmer,
something that we'll consider in more advanced detail later on during the course. -
ANSWER interpreted language
Object-oriented Python language
, There are many different types of objects in Python.such as - ANSWER strings,
integers and floats.
strings, integers and floats. float(x) does what - ANSWER cast x to flot
Convert string to integer - ANSWER int('1')
String, we can index string using numbers Musa[1] - ANSWER indexing
Replicate String = 3* Names - ANSWER NamesNamesNames
Names.Find('isa').find substring. - ANSWER the method finds starting index of a
substring
Find number of character : len("Michael Jackson") - ANSWER find length of charcter
Slicing : We can get more than one characters in a string by slicing. NAME = "TIJJANI"
○ - ANSWER NAME[0:4] = TIJJ
Concatenate String IN PYTHON - ANSWER Statement = Name + "is the best"
replace the old substring with the new target substring is the segment has been found in
the string
A = "Michael Jackson is the best"
B = A.replace('Michael', 'Janet') - ANSWER Replace method:
find the first index of the sub-string - ANSWER G.find('snow')