Last Updated on August 28, 2021 by Admin 2
HOTSPOT
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.
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.
Subscribe
Login
0 Comments