Problem Statement
In this challenge, you must print the string ‘Hello World’ for given N number of times.
Input
The first line of input consists of an integer n
, where 0>=n
.
Output
Print Hello World
for n
number of times.
As is
The boilerplate code is already there to read the input from user, in the main()
function. Do not edit this code.
To do ✍
printHelloWorld()
has one parameter: n
. Complete the function that prints Hello World
for n
times.
Example 1
Test input
2
Test output
Hello World
Hello World
Example 2
Test input
5
Test output
Hello World
Hello World
Hello World
Hello World
Hello World
Python Program
# Complete the following function
def printHelloWorld(n):
# Boilerplate code - Do not edit the following
def main():
n = int(input())
printHelloWorld(n)
if __name__ == "__main__":
main()
Input and Outputs 1
5
Hello World
Hello World
Hello World
Hello World
Hello World
Input and Outputs 2
0
Input and Outputs 3
1
Hello World
# Complete the following function
def printHelloWorld(n):
for i in range(n):
print('Hello World')
# Boilerplate code - Do not edit the following
def main():
n = int(input())
printHelloWorld(n)
if __name__ == "__main__":
main()