# NewMultiply.py - This program prints the numbers 0 through 10 along # with these values multiplied by 2 and by 10. # Input: None # Output: Prints the numbers 0 through 10 along with their values multiplied by 2 and by 10. head1 = "Number: " head2 = "Multiplied by 2: " head3 = "Multiplied by 10: " NUM_LOOP_START: = 2 # Constant used to control loop NUM_LOOP_END = 10 # Constant used to control loop print("0 through 10 multiplied by 2 and by 10.") # Write your for loop here for number in range(NUM_LOOP_START,NUM_LOOP_END): print(head1 +str (number)) print(head2 +str(number *2)) print(head3 +str(number *10)) it says line 10 needs to be fix im doing mindtap using loop in python https://www.youtube.com/watch?v=TYSLiRruClk
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.
Introduction
Python Function:
A function in Python is a segment of code that may be reused to carry out a single operation or group of related tasks. Code was split into smaller, simpler, and reusable pieces using functions, which can accept input parameters and numerical results.
Here's the general syntax for defining a function in Python:
def function_name(a1, a2, ...):
# Function body (statements to be executed)
return result # (Optional) Return a value
In this syntax, def is the keyword used to define a function, function_name is the name of the function, and (argument1, argument2, ...) are the input arguments the function takes (optional). The function body consists of statements that perform a specific task or set of tasks, and the return statement (optional) specifies the value or values that the function will return.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images