Question 2
During school holidays, you volunteer to explain some basic programming concepts to younger siblings.
You want to introduce the concept of data types in Python. You create the following three code segments:
You need to evaluate the code segments.
For each of the following statements, select Yes if the statement is true. Otherwise, select No.
NOTE: Each correct selection is worth one point.
Correct answer: To work with this question, an Exam Simulator is required.
Explanation:
Code Segment 1: You cannot convert str to int. x1 = “2” is a string. Therefore code will produce an error.Code Segment 2: b = 1.5, which is a float.Code Segment 3: c = 2.5, which is a float, not an int.References: https://www.w3resource.com/python/python-data-type.php
Code Segment 1: You cannot convert str to int. x1 = “2” is a string. Therefore code will produce an error.
Code Segment 2: b = 1.5, which is a float.
Code Segment 3: c = 2.5, which is a float, not an int.
References: https://www.w3resource.com/python/python-data-type.php