Solution : To get output of range command
Title
Question
range(20) when entered in ipython console will give you output as same range(20) again. <span style="background-color: rgb(250, 250, 250);">To see the actual numbers type:</span>
list(range(20)) <span style="background-color: rgb(250, 250, 250);">it will typecast to list and output will be </span><span style="background-color: rgb(250, 250, 250);">[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]</span>
Python-3.4.3 Getting-started-with-for 06-07 min 10-20 sec
Answers:
Correct! In python 2.7, we get the list whereas in python3 we need to explicitly do type casting.
The solution slide is updated but not yet reflected.
Login to add comment