Robotics & Artificial Intelligence
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:]) |
Python Funda
3 Likes
Answer
| Statement | Output |
|---|---|
| print(list1) | ['Robotics', 2026, 'ICSE', 'Edition'] |
| print(list1[0]) | Robotics |
| print(list1[1:3]) | [2026, 'ICSE'] |
| print(list1[2:]) | ['ICSE', 'Edition'] |
Answered By
3 Likes
Related Questions
Name the following constants as defined in Python:
Constants Name of the constant 0.00345 'A' True -999 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:
Statement Output a = 24
m = float(a)
print(m)b = 32.86
n = int(b)
print(n)c = 3
p = complex(c)
print(p)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.