get started with python coursera week 3 quiz answers Test your knowledge: While loops 1. Fill in the blank: A while loop instructs your computer to continuously execute your code based on the value of a _____. Answers conditioncomparatordata typefunction 2. A data professional wants to set up a while loop that will iterate as long as the variable x is less than 7. They assign the value 0 to the variable x. What code should they write next? Answers loop x < 7:repeat x < 7:while x < 7:iterate x < 7: 3. In Python, the keyword break lets you escape a loop without triggering any else statement that follows it in the loop. Answers TrueFalse Test your knowledge: For loops 4. A data professional can use a for loop to perform which of the following tasks? Answers To repeat a specific block of code until a condition is metTo convert one data type to anotherTo iterate over a series of numbersTo define a function 5. A data professional wants to set up a for loop. They write the following code: for x in range(3): . What values will the variable x take? Answers 0, 1, and 21, 2, and 3Only 30, 1, 2, and 3 6. What parameter of Python’s range() function specifies the size of the increments in a sequence of numbers? Answers Stop valueLoop valueStep valueStart value Test your knowledge: Strings 7. In Python, what is the term for the portion of a string that can contain more than one character? Select all that apply. Answers String sliceSubstringString segmentSuperstring 8. If you’re reading from left to right, what is the index of the first character in a string? Answers 0123 Shuffle Q/A 1 9. A data professional wants to insert specific substrings in a larger string. What method can they use to do so? Answers type()range()format()print() Weekly challenge 3 10. A data professional can use a while loop to perform which of the following tasks? Answers To repeat a specific block of code until a condition is metTo define a functionTo convert one data type to anotherTo iterate over a sequence of values Next Share the love Share this content Opens in a new window Opens in a new window Opens in a new window Opens in a new window Opens in a new window Opens in a new window You Might Also Like Week 1 – Introduction to asset security – Shuffle Q/A 1 Module 1 – Foundations of Convolutional Neural Network Week 2 – C# Programming Fundamentals Leave a Reply Cancel replyCommentEnter your name or username to comment Enter your email address to comment Enter your website URL (optional) Save my name, email, and website in this browser for the next time I comment.