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
36
11
143
13.2K
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. Therefore, it only produces the value 0. The outer loop for i in range(1) runs once, with i assigned the value of 0. Inside the first loop iteration, the
English
1
2
19
719
Project Psyche 2025
Project Psyche 2025@Matthew15280451·
The answer is c range(1) produces only one value: 0 Outer loop: i = 0 Inner loop: j = 0 print(i, j) runs once This is explained differently but same reasoning as my control logic in Psyce the control logic by contrast is a topological loop, not a syntactic one. The control system therefore operates in a continuous cyclic steady state, not a terminating computation as you have presented
English
1
1
1
223
Kamal Gurjar
Kamal Gurjar@KamalGurjar8·
@PythonPr Answer: 0 0 range(1) iterates once, starting from 0 — so both i and j are 0.
English
0
0
1
503
Jimmy Fikes
Jimmy Fikes@akajim·
@PythonPr C. The two ranges will print the first index values (0) but can’t print 1.
English
0
0
0
286
i/o
i/o@__sunuuu·
@PythonPr Since range(1) start at 0 and stop before 1 . So : c. 0 0
English
0
0
0
447
Paylaş