Pagina de inicio
/
Tecnología
/
What will this code output? fori in range(3): print("Python") A) Python Python Python Python Python (repeated 3 times on separate lines) An error

Problemas

What will this code output?
fori in range(3):
print("Python")
A) Python
Python Python Python
Python (repeated 3 times on separate lines)
An error

What will this code output? fori in range(3): print("Python") A) Python Python Python Python Python (repeated 3 times on separate lines) An error

Solución

avatar
Gerardoélite · Tutor durante 8 años
expert verifiedVerificación de expertos
4.2 (293 votos)

Responder

'Python (repeated 3 times on separate lines)'

Explicar

## Step 1<br />The given code is a simple Python script that uses a for loop to iterate over a range of numbers. The range is set to 3, which means the loop will run three times.<br /><br />## Step 2<br />The print statement inside the loop is "Python". This statement is executed each time the loop runs.<br /><br />## Step 3<br />Since the loop runs three times, the print statement "Python" will be executed three times, each time on a new line.
Haz clic para calificar: