Computer Science, asked by Shubhkarman16, 9 months ago

In python I want to code something like this

x=a+b
y=a*b

Z=x+y
W=x*y

C=z+W
D=z*w..


Now I want to repeat this code several times. Can I do this using a loop?

Answers

Answered by AskewTronics
2

Yes this code can be repeated using for loop:

Explanation:

  • When the user wants to repeat the above code using for loop, then he needs to write the below two statements:-

          a=a*b

          b=a+b

  • If the user writes the above two statements, and the loop condition will set on several times. Then it will give the same result which the above code will give.
  • It is because the above code will add the additional value and multiplication value of two numbers. So the above code also does the same.

Learn More:

  • For loop: https://brainly.in/question/2359999
Similar questions