Computer Science, asked by Maheshpillai, 6 months ago

using python script mode print your school name 5 times​

Answers

Answered by joydeepkundu7
7

Answer:

  1. If you know the range in python it is very easy to print without using loops.
  2. Here you asked to print "hello, world!" string 5 times,without using loop we can print it by multiplying it inside the print statement.
  3. So, that print statement prints "hello, world" 5 times.
Answered by AneesKakar
0

Python code to print your school name 5 times:

school_name = "XYZ School"

# Use a loop to print the school name 5 times

for i in range(5):

   print(school_name)

Explanation:

  • The first line of the code creates a variable named "school_name" and assigns it the value of "XYZ School". One might replace "XYZ School" with the actual name of the school.
  • The second line of the code starts a "for" loop that will repeat the above code block 5 times. The "range(5)" function generates a sequence of numbers from 0 to 4, which will be used as the values of the "i" variable in each iteration of the loop.
  • The third line of the code prints the value of the "school_name" variable. This line is indented to show that it is part of the loop.
  • When the code is run, it will print the name of the school 5 times, as specified by the "range(5)" function in the "for" loop. If one wants to print the name of the school more or fewer times, then one can change the argument of the "range()" function accordingly.

#SPJ3

Similar questions