55.3k views
1 vote
What is the output of this line of code: print("hello" * 3)?

User Tooschee
by
7.2k points

2 Answers

2 votes

Answer:

hellohellohello will be the output.

Step-by-step explanation:

This is a code of Python language. Print function in python is used to print any thing. You can print anything as it is by writing it in quotes(""). For example, print("Hello World") will give the output Hello World. You can also print the sum of addition using print() function by writing it without quotes(""). For example, print(2+2) will give the output 4 and print(2*2) will give the output 4 and print(2/2) will give the output 1 and print(2-2) will give the output 0, and so on.

So, in this it is written print("hello" * 3). So, first it will print hello as it is because, it is in quotes, and after that it will print it 3 more time because, in code there is written *3, so it printed hello 3 times. In image below you can see input and output.

What is the output of this line of code: print("hello" * 3)?-example-1
User Amr Ali
by
7.6k points
4 votes

Answer:

The answer to this question is given below in the explanation section.

Step-by-step explanation:

This is the code statement of the python language. When you will run this line of code it will print the word "hello" three times on a line without any space between the word "hello"as given below:

hellohellohello

The print() function of the python language print the string given in the double quotation as the first parameter. The second parameter multiple of the first parameter.

User David Oneill
by
7.1k points