what is the answer to this question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what is the answer to this question

numbers = list(range(5, 10, 2))

8th Dec 2022, 9:02 AM
alvin gachogu
alvin gachogu - avatar
2 Answers
+ 8
alvin gachogu If you print the statement you will get the answer... This will return list value, [5,7,9] According to the range first 5 printed and it is incremented by 2 so 7 again incremented by 2 so 9 It will Stop since range is upto 10 which is exclusive..
8th Dec 2022, 9:15 AM
Riya
Riya - avatar
+ 6
[5, 7, 9]. The list() function creates a new list by converting an iterable (in this case, the range range(5, 10, 2)) to a list. The range range(5, 10, 2) generates a sequence of numbers starting at 5 and increasing by 2, up to but not including 10. This means that the list numbers will contain the numbers 5, 7, and 9. Here is an example of how it could be used: https://code.sololearn.com/cM5a2L3NIOfJ/?ref=app
9th Dec 2022, 10:00 AM
Sadaam Linux
Sadaam Linux - avatar