Computer Science, asked by sahunandini2656, 4 months ago

using python scirpt mode and print your school name five times​

Answers

Answered by YUVILOVE2009
0

Answer:

However, since i begins at an index of 0, it works out perfectly, in that the number you specify in the range() function is the number of times a statement is executed. So, the code above gives the following output shown ...

Answered by MrPrince07
0

Explanation:

In this article, we show how to print out a statement any number of times you want in Python.

So, basically, to do this, we are going to use a for loop with the keyword range in the statement.

Using this method, we can print out a statement any number of times we want by specifying that number in the range() function.

Below we print out the statement, "hello world" 5 times.

for i in range(5):

print("hello world")

Since i starts with 0, the statement prints out 5 times. i goes from 0 to 1 to 2 to 3 to 4.

In the range() function, the number you specify is exclusive, meaning it is not included in the loop. However, since i begins at an index of 0, it works out perfectly, in that the number you specify in the range() function is the number of times a statement is executed.

So, the code above gives the following output shown below.

hello world

hello world

hello world

hello world

hello world

To print out "hello world" 10 times, the code would be as that shown below.

for i in range(10):

print("hello world")

The statement, "hello world", now gets printed out 10 times.

If you want to print out, "hello world" 50 times, the code would be that as shown below.

for i in range(50):

print("hello world")

"hello world" now gets printed out 50 times.

Of course, you can execute multiple statements in the for loop.

The code below prints out the statements "It is good" and "Actually it's great" 5 times.

for i in range(5):

print("It is good")

print("Actually it's great")

Similar questions