7. What is the output of the following?for i in range(float('inf')):print(i)*4 points0.0 0.1 0.2 0.3...0 1 2 3...0.0 1.0 2.0 3.0...none of the mentioned
Question
- What is the output of the following?for i in range(float('inf')):print(i)*4 points0.0 0.1 0.2 0.3...0 1 2 3...0.0 1.0 2.0 3.0...none of the mentioned
Solution
The code you provided is not valid in Python. The range function does not accept a float as an argument, even if it is float('inf'). Therefore, the code will raise a TypeError. So, the correct answer is "none of the mentioned".
Similar Questions
What will be the output of the following Python code?for i in range(int(float('inf'))): print (i)
. What will be the output of the following code snippet?x = [i for i in range(6)]y = [i**3 for i in x]print(y) [0, 1, 8, 27, 64, 125][1, 8, 27, 64, 125, 216][0, 1, 4, 9, 16, 25][0, 1, 8, 27, 64]
What will be the output of the following code?i = 3for i in range (4) print (i) 0 1 2 3 1 2 3 4 3 4 5 6 3 2 1 0
9. What will be the output of the following Python code?x = (i for i in range(3))for i in x: print(i)for i in x: print(i)
What will the following code generate?for i in range(0, 12, 3): print(i)A.0 1 2 3 4 5 6 7 8 9 10 11B.0 3 6 9C.0 1 2 3 4 5 6 7 8 9 10 11 12D.0 3 6
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.