The first screenshot is my code and when I run the program. It ouputs to: bop bop bop but I need it to output all on one line like the 2nd screenshot. " bop bop bop" and I need to know how to end it with a period after the user plugs in how many times they want it to repeat for. Can't use the 'end=""' function or anything complex. again no using "end=" function or any other similar function. Must stick to using while looping function. Cannot use "import sys" or "sys.stdout.write". must use simple while loop command repeating bop 3 times should print “bop bop bop”. can not use "append" function. USE WHILE LOOP FUNCTION to reproduce the word all on the same line without breaking
Types of Loop
Loops are the elements of programming in which a part of code is repeated a particular number of times. Loop executes the series of statements many times till the conditional statement becomes false.
Loops
Any task which is repeated more than one time is called a loop. Basically, loops can be divided into three types as while, do-while and for loop. There are so many programming languages like C, C++, JAVA, PYTHON, and many more where looping statements can be used for repetitive execution.
While Loop
Loop is a feature in the programming language. It helps us to execute a set of instructions regularly. The block of code executes until some conditions provided within that Loop are true.
The first screenshot is my code and when I run the program. It ouputs to:
bop
bop
bop
but I need it to output all on one line like the 2nd screenshot. " bop bop bop" and I need to know how to end it with a period after the user plugs in how many times they want it to repeat for. Can't use the 'end=""' function or anything complex.
again no using "end=" function or any other similar function. Must stick to using while looping function.
Cannot use "import sys" or "sys.stdout.write". must use simple while loop command
repeating bop 3 times should print “bop bop bop”.
can not use "append" function. USE WHILE LOOP FUNCTION to reproduce the word all on the same line without breaking
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images