Ii 3 Types And Operators 9 Points Each The Variables X And Y Are Set For You In The Next Read Only Cell Use Only The 1 (33.36 KiB) Viewed 45 times
Ii 3 Types And Operators 9 Points Each The Variables X And Y Are Set For You In The Next Read Only Cell Use Only The 2 (11.95 KiB) Viewed 45 times
II.3: types and operators (9 points each) The variables x and y are set for you in the next read only cell. Use only the variables x and y, the functions int(), str() and the operators am to make the following variables have these types and values: • A (float) 1.0 . B (int) 12 C (str) 3333 D (str) 43 E (int) 44) Note: for example, for the first case writing A= 1.0 is not a satisfactory solution because it uses 1 but you can only use the variables x and y, the functions int(), str() and the operators and In [ ]: x = '4' y = 3.0 #Hint: for example, if we wanted to create z (float) 7.0 we could write the following code z float(x) + y In 1: YOUR CODE HERE raise NotImplementedError() In [ ]: assert isinstance (A, float) assert A 1 In 1: assert isinstance(8, int) assert 12 In []: assert isinstance(C, str) assert ( 3333
In [ ]: assert isinstance(D, str) assert D == '43' In [ ]: assert isinstance (E, int) assert E == 44
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!