Post

Python Programming
Python Programming@PythonPr·
Python Question / Quiz; What is the output of the following Python code, and why? Comment your answers below!
Python Programming tweet media
English
34
7
188
15.8K
Earnest Codes
Earnest Codes@Earnesto037·
@PythonPr Answer: (C) 0 0 The range(1) function generates a sequence of numbers starting from 0 up to (but not including) 1, which means it only contains the number 0. The outer loop for i in range(1) runs once, with i assigned the value 0. Inside the outer loop, the inner
English
1
0
11
441
Pranav Guha
Pranav Guha@_pranavgt·
@PythonPr Answer: C) 0 0 range(1) starts at 0 and stops before 1, so the only value is 0. That means the loops run once with i = 0 and j = 0.
English
0
0
6
838
Kamal Gurjar
Kamal Gurjar@KamalGurjar8·
@PythonPr Answer: C) 0 0 ✅ Why: range(1) runs only once with value 0. Outer loop: i = 0 Inner loop: j = 0 print(i, j) prints 0 0 once.
English
0
0
6
895
Coding Computing Coach
Coding Computing Coach@CodingComputing·
@PythonPr Answer: C. 0 0 Solution: Just need to be clear on `range` usage with a single argument. range(a) is equivalent to range(0, a) ie, starting from 0, stopping at a (a won't be in the range). So, range(1) is range(0, 1) starting from 0, stopping before 1. So just 0 +
English
1
0
3
242
Caffeine Quant
Caffeine Quant@CaffeineQuant·
@PythonPr Option C. 0 0 Fundamental syntax. But in our HFT architecture, we avoid nested loops for execution. Vectorized calculations with NumPy are the only way to beat the latency. ⚡️
English
0
0
1
9
Swasti Naik
Swasti Naik@naik_swasti·
@PythonPr Answer 0, 0 Because the range of iteration starts from 0 till less than 1 for both nested loops so it will print 0, 0.
English
0
0
1
209
John De Beloved
John De Beloved@John_DeBeloved·
@PythonPr The output is 0,0: in inner and outer range(1), starts at zero and stops before 1.
English
0
0
1
207
Legacy
Legacy@Legacy25686·
@PythonPr Please I want to learn about python can I be thought
English
0
0
0
32
Virat Raj
Virat Raj@ViratRaj1734972·
@PythonPr Option -C Reason- because indexing is starting from 0 and it excludes the last given value
English
0
0
0
113
Jimmy Fikes
Jimmy Fikes@akajim·
@PythonPr C. With range(1) the only thing that can print is zero.
English
0
0
0
275
Tripti Choudhary.
Tripti Choudhary.@Tripti0101·
@PythonPr C . 0 0 Range passed is 1 which means it will print number from 0 to 1 but excluding 1 .
English
0
0
0
235
Paylaş