LinkedIn Python Skill Assessment Quiz Answers

When would you use a while loop?

Latest Update on 25th January, 2022 by Certification Course Answers

When would you use a while loop?

  1.  when you want to minimize the use of strings in your code
  2.  when you want to run code in one file while code in another file is also running
  3.  when you want some code to continue running as long as some condition is true
  4.  when you need to run two or more chunks of code at once within the same file

Correct Answer:

  •  when you want some code to continue running as long as some condition is true

Simple Example

i = 1
while i<6:
    print('Countdown:',i)
    i = i + 1

Latest Updates

No posts found in this category.