PRACTICE QUIZ
What is the type of the following: 0 Explanation, as there is no decimal the number is of type int. You can also use the type function to verify your results.
What is the type of the following number: 3.12323 Explanation, as there is a decimal the number is of type float. You can also use the type function to verify your results.
What is the result of the following: int(3.99) Explanation. In Python, if you cast a float to an integer, the conversion truncates towards zero, i.e.you just get rid of the numbers after the decimal place. So for 3.99 you just get rid of the ".99" leaving 3. PRACTICE QUIZ
What is the result of the following operation: 11//2
this is correct, the symbol // means integer value. Therefore you must round the result down.
what is the value of x after the following is run:
the value x=x/2 changes the value of x, if x is assigned to its self. It's helpful to replace the value of x with its current value in this case 4 or x=4/2. We can also see that the result is a float. PRACTICE QUIZ
What is the result of the following: Name[0] ( Image S3Q1 ) Explanation, The index 0 corresponds to the first index
What is the result of the following: Name[-1] ( Image S3Q2 ) Explanation, the index -1 corresponds to the last index
What is the output of the following: print("AB\nC\nDE") DE CD E C DE (CORRECT)
when the print function encounters a \n it displays a new line
What is the result of following? "hello Mike".find("Mike") If you are unsure, copy and paste the code into Jupyter Notebook and check. Explanation, the method finds the starting index of a substring MODULE 1 GRADED QUIZ
What is the value of x after the following lines of code? x=2 x=x+2
the value x=x+2 changes the value of x, if x is assigned to its self. It's helpful to replace the value of x with its current value in this case 2 or x=2+2.
What is the result of the following operation 3+2*2 ? Explanation, Python follows the standard mathematical conventions
What is the result of the following code segment: type(int(12.3)) Explanation, in this code, we first cast or convert the float to an integer, then use the type function to determine the type
What is the result of the following code segment: int(True) Explanation, when you cast a boolean True to an integer you get a 1
In Python, what is the result of the following operation: '1'+'2' ? Explanation, the '+' applied to strings does not add strings but concatenates them
Given myvar = 'hello' , how would you return myvar as uppercase?
What is the result of the following : str(1)+str(1) ? Explanation, the integers are cast to a string, and the strings are concatenated
What is the result of the following: "ABC".replace("AB", "ab") ? Explanation, the method replace returns a copy of the string with all occurrences of the old substring
In Python 3, what is the type of the variable x after the following: x=1/1 ? Explanation, in Python 3, regular division always results in a float
What is the value of x after the following lines of code? x=1 x=x+1
the value x=x+1 changes the value of x, if x is assigned to its self. It's helpful to replace the value of x with its current value in this case 1 or x=1+1.
What is the result of the following code segment: int(False) Explanation, when you cast a boolean False to an integer you get a 0
What is the result of the following: 'hello'.upper() ? Explanation, upper returns a copy of the string in which all case-based characters have been converted to uppercase.
What is the result of the following operation 1+3*2 ? Explanation, Python follows the standard mathematical conventions
What is the result of the following : str(1+1) ? Explanation, the argument is first evaluated 1+1=2, then the result is cast to a string.
What is the result of the following: "123".replace("12", "ab") ? Explanation, the method replace returns a copy of the string with all occurrences of the old substring
What is the type of the following "7.1" Explanation, the type is string
In Python 3, what is the type of the variable x after the following: x=2/2 ? Explanation, in Python 3, regular division always results in a float
What is the type of the following: 0
What is the type of the following number: 3.12323
What is the result of the following: int(3.99)
What is the result of the following operation: 11//2
What is the result of the following: Name[0]
What is the result of the following: Name[-1]
What is the output of the following: print(“AB\nC\nDE”)
What is the result of following?
Ready to test your recall?
What is the type of the following: 0 Explanation, as there is no decimal the number is of type int. You can also use the type function to verify your results.
How confident are you in this answer?