Write a program that asks the user for their name and how many times to print it. If I enter Bob and 4 it should print:
Bob
Bob
Bob
Bob
Which loop correctly does this?
Group of answer choices
name = input("Enter your name: ")
num = int(input("Enter a positive number: "))
c = 0
while (c > num):
print (name)
c = c + 1
name = input("Enter your name: ")
num = int(input("Enter a number: "))
c = 0
while (c < num):
print(name)
c = c + 1
name = input("Enter your name: ")
num = int (input("Enter a number: "))
c = 1
while (num <= name):
print (name)
c = c + 1
name = input("Enter your name: ")
num = int(input("Enter a number: "))
c = 0
while(c <= num):
print (name)
Answer:
name = input("Enter your name: ")
num = int(input("Enter a number: "))
c = 0
while c < num:
print(name)
c += 1
Explanation:
This loop correctly prints the user's name for the specified number of times because it starts with c = 0 and continues to print and increment c until it reaches the value of num. The other loops either have incorrect conditions for the while loop to terminate or do not increment c correctly.
The program that asks the user for their name and how many times to print it is in explanation part.
What is programming?The process of creating a set of instructions that tells a computer how to perform a task is known as programming.
Computer programming languages such as JavaScript, Python, and C++ can be used to create programs.
The loop that correctly prints the user's name the specified number of times is:
name = input("Enter your name: ")
num = int(input("Enter a positive number: "))
c = 0
while (c < num):
print(name)
c = c + 1
This loop sets the counter variable c to 0 and then enters a while loop that runs as long as c is less than the number of times the name is printed.
Thus, the program prints the user's name and increments the counter variable by one until the desired number of times is reached within the loop.
For more details regarding programming, visit:
https://brainly.com/question/11023419
#SPJ2
what are some proxy sites for school
Answer: Something that's not bad.
Explanation: Like maybe school work sites like classroom or docs stuff like that i guess.
Consider the following code:
for i in range (x, y):
print (i, end=" ")
What values for x and y will output the code below?
10 11 12 13 14 15 16 17 18 19
Group of answer choices
x = 19
y = 9
x = 10
y = 19
x = 10
y = 20
x = 19
y = 10
Answer:
x = 10
y = 20
Explanation:
The for loop is executed with the loop variable i taking on the values x, x+1, x+2, and so on, up to but not including y.
Since we want to output the numbers from 10 to 19 inclusive, we need to start the loop with x = 10 and end it with y = 20 (not inclusive).
The statement print(i, end=" ") is executed on each iteration of the loop, which prints the value of i followed by a space, without moving to a new line.
So the correct answer is x = 10 and y = 20.
Which loop prints the numbers 1, 3, 5, 7, …, 99?\
c = 1
while (c <= 99):
c = c + 2
print(c)
c = 1
while (c < 99):
c = c + 1
print(c)
c = 1
while (c <= 99):
print(c)
c = c + 2
c = 1
while (c < 99):
print(c)
c = c + 1
The loop that prints the numbers 1, 3, 5, 7, …, 99 is:
The Loopc = 1
while (c <= 99):
print(c)
c = c + 2
This loop initializes the variable c to 1, then enters a while loop that continues as long as c is less than or equal to 99.
During each iteration of the loop, the value of c is printed using the print function, and then c is incremented by 2 using the c = c + 2 statement.
This means that the loop prints out every other odd number between 1 and 99, inclusive.
Read more about loops here:
https://brainly.com/question/19344465
#SPJ1
What guideline should you use when attaching a document to an email?
A.
make sure the attachment is large enough to send
B.
use shorthand in the title so the title is short
C.
use a descriptive title for the document
D.
use document software that others might not have
Answer:
C
Explanation:
Option C is the correct answer. By using a descriptive title, the recipient of the email will know what the document contains without having to open it. This will also help the recipient to easily find the document if they need to refer to it later.