Computer Science
Which of the following Python functions is used to iterate over a sequence of numbers by specifying a numeric end value within its parameters ?
- range()
- len()
- substring()
- random()
Related Questions
What will be the output generated by the following snippet?
a = [5,10,15,20,25] k = 1 i = a [1] + 1 j = a [2] + 1 m = a [k + 1] print (i, j , m)
- 11 15 16
- 11 16 15
- 11 15 15
- 16 11 15
The process of arranging the array elements in a specified order is termed as:
- Indexing
- Slicing
- Sorting
- Traversing
What is the output of the following ?
d = {0: 'a', 1: 'b', 2: 'c'} for i in d: print(i)
1.
0 1 2
2.
a b c
3.
0 a 1 b 2 c
4.
2 a 2 b 2 c
What is the output of the following ?
x = 123 for i in x: print(i)
- 1 2 3
- 123
- Error
- Infinite loop