Robotics & Artificial Intelligence
Predict the output when executed:
| Statement | Output |
|---|---|
| a = 24 m = float(a) print(m) | |
| b = 32.86 n = int(b) print(n) | |
| c = 3 p = complex(c) print(p) |
Python Funda
3 Likes
Answer
| Statement | Output |
|---|---|
| a = 24 m = float(a) print(m) | 24.0 |
| b = 32.86 n = int(b) print(n) | 32 |
| c = 3 p = complex(c) print(p) | (3+0j) |
Answered By
3 Likes
Related Questions
Predict the output and type of casting for the given Python expressions:
Python Expression Explicit/Implicit m = 32.005, n = 45
print(int(m+n))a = 42.85, b = 12.45
print(a+b)Predict the output when executed:
Given: list1 = ['Robotics', 2026, 'ICSE', 'Edition']
Statement Output print(list1) print(list1[0]) print(list1[1:3]) print(list1[2:]) Assertion (A): Variable is a named memory location which contains a value.
Reason (R): When you create a variable, it reserves some space in the memory.
Based on the above discussion, choose an appropriate statement from the options given below:
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true and R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
- Both A and R are false.
In Python programming, it is an unordered collection data type that is iterable, mutable and has no duplicate elements. It is represented by { } where the values are enclosed in curly braces.
Read the above paragraph and answer the following questions:
(a) Name the data type that is used in Python.
(b) What will happen, if duplicate elements are present in this data types and executed?