asked 17.9k views
10 votes
Describe a situation in a program where you could write and use a "for loop".​

asked
User Atott
by
8.0k points

2 Answers

3 votes
Suppose you want to display even numbers on different lines on the web page your can use for loop.
Another example: if you want to display asterisk (*) 10 times on different lines without using document.write or console.log 10 times. Then u can use for loop…

I hope this helps…
answered
User Nishit
by
7.9k points
3 votes

Answer: You can use a for loop for situations such as a questionnaire, data collection etc.

Step-by-step explanation:

A 'For Loop' is a loop variable. As I said before, you can use it in instances such as questionnaires and data collection. To use a For Loop in Python simply type "for [VARIABLE] in range([HOW LONG YOU WANT THE LOOP TO GO]):. Indentation is key for this, so remember to always end this line of code with a colon.

answered
User Strave
by
8.7k points
Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.

Categories