kendrawalraven
19.12.2022 •
Computers and Technology
Profiling uses to find patterns in a dataset which uniquely identify an individual.
Solved
Show answers
More tips
- S Style and Beauty Is Hot Scissor Haircutting Beneficial or Dangerous?...
- S Style and Beauty How to Get Rid of Under Eye Bruises?...
- F Food and Cooking Is Bacon Good for You?...
- S Style and Beauty Discover the Art of Nail Design: How Do You Paint Your Nails?...
- P Philosophy How to Develop Extrasensory Abilities?...
- O Other Everything You Need to Know About Kudyabliks...
- C Computers and Internet The Twitter Phenomenon: What it is and How to Use it...
- C Computers and Internet How to Choose a Laptop: Expert Guide and Tips...
- C Computers and Internet How to Choose a Monitor?...
- H Horoscopes, Magic, Divination Where Did Tarot Cards Come From?...
Answers on questions: Computers and Technology
- C Computers and Technology Which of the following is NOT part of the URL for an Internet web site?...
- C Computers and Technology Palindrome word is a word that reads the same backward as forward, e.g., madam. Circle and fix all the mistakes in the following code snippet that counts the number of...
- C Computers and Technology 15) In Java, instantiation means A) noticing the first time something is used B) creating a new object of the class C) creating a new alias to an existing object D) launching...
- C Computers and Technology Write a program that asks an employee how many hours were worked this week. The base pay rate is $12.50 / hr. For overtime hours (over 40), the employee should be paid...
- C Computers and Technology When you leave a slack channel does it delete personal messages...
- C Computers and Technology When my slack launches on mac i get a black screen...
- C Computers and Technology Which html attribute specifies an alternate text for an image, if the image cannot be displayed?...
- C Computers and Technology 24 deadly sins of software security : programming flaws and how to fix them pdf...
- C Computers and Technology Look at this drawing of two cans of juice. which will pour more easily?...
- M Mathematics Which function describes this graph?...
Ответ:
The code segment was written in Python Programming Language;
The while loop equivalent is as follows:
i = 1
j = 1
while i < 6:
while j < i + 1:
print('*',end='')
j = j + 1
i = i + 1
print()
Explanation:
(See attachment for proper format of the program)
In the given lines of code to while loop, the iterating variables i and j were initialised to i;
So, the equivalent program segment (in while loop) must also start by initialising both variables to 1;
i = 1
j = 1
The range of the outer iteration is, i = 1 to 6
The equivalent of this (using while loop) is
while ( i < 6)
Not to forget that variable i has been initialized to 1.
The range of the inner iteration is, j = 1 to i + 1;
The equivalent of this (using while loop) is
while ( j < i + 1)
Also, not to forget that variable j has been initialized to 1.
The two iteration is then followed by a print statement; print('*',end='')
After the print statement has been executed, the inner loop must be close (thus was done by the statement on line 6, j = j + 1)
As seen in the for loop statements, the outer loop was closed immediately after the inner loop;
The same is done in the while loop statement (on line 7)
The closure of the inner loop is followed by another print statement on line 7 (i = i + 1)
Both loops were followed by a print statement on line 8.
The output of both program is
*
*
*
*
*