1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
7nadin3 [17]
3 years ago
12

What is wrong with this code and correct it.

Computers and Technology
1 answer:
balandron [24]3 years ago
8 0

Answer:

What's wrong?

The line_str variable needs to be re-initialized at the end of each printing

The correction

Include the following line immediately after the print statement

       line_str = ""

Explanation:

Required

Correct the code

The conditions are correct. However, the string variable line_str needs to be set to an empty string at the end of every of the iteration loop.

This will allow the code to generate a new string.

So, the complete function is:

<em>def swapping_stars(): </em>

<em>    line_str = "" </em>

<em>    for line in range(0, 6): </em>

<em>        for char in range(0,6): </em>

<em>            if line % 2 == char%2: </em>

<em>                line_str += "*" </em>

<em>            else: </em>

<em>                line_str += "-" </em>

<em>        print(line_str) </em>

<em>        line_str = ""</em>

You might be interested in
Does anyone know to get Google updated if it failed to update?
Yuri [45]
You adapt the situation and overcome the situation, look it up this is not school relevant
4 0
4 years ago
A folder can contain only files? A. True B.False
choli [55]
That statement is true.
In recent technologies, folder can contain whatever users want it to contain.  Not only, that, users could also arrange the maximum size of files that a folder could contain or the visibility status of each items that will be placed on the shoulder in case they need some sort of privacy for his/her files

8 0
3 years ago
Read 2 more answers
John works as an associate at a construction company. His job is to draft contracts for suppliers. Before he prints the contract
worty [1.4K]

Answer:

The correct answer would be option B, Track changes.

Explanation:

John's job is to make drafts and print them. Before printing them, he sends the copy to the manager to get it checked for any mistakes. John's manager can give suggestions and edit the document where he thinks he needs to do. So he can use the Track changes feature to give his comments or suggestions as well as to edit the document. He will simple open the document, open the Review tab, and Click on the Track changes or comments icon. Here he can click on the text which he wants to edit, and there will be a pan which will keep track of the changes and mark them with red, so that John knows where he has made the changes or given the suggestions.

7 0
3 years ago
When is it appropriate to delete an entire row or column as opposed to deleting the data in the row or column
borishaifa [10]

Answer:

huh wdym

Explanation:

7 0
3 years ago
When you call a ____________ method, it executes statements it contains and then returns a value back to the program statement t
Maksim231197 [3]

Answer:

The answer is a VOID method.

Explanation:

A void method is one that simply performs a task and then terminates.

4 0
4 years ago
Read 2 more answers
Other questions:
  • What file formats can you safely use in a video presentation
    14·1 answer
  • How to write a program that prompts the user to input two POSITIVE numbers — a dividend (numerator) and a divisor (denominator).
    13·1 answer
  • What are three situations when recursion is the only option available to address problems?
    10·1 answer
  • In the accompanying figure, the split double arrow mouse pointer____.
    7·1 answer
  • For what parties the prepare documentation ​
    9·1 answer
  • 3. Which of the following is called address operator?<br> a)*<br> b) &amp;<br> c).<br> d) %
    12·1 answer
  • Write a program that outputs inflation rates for two successive years and whether the inflation is increasing or decreasing. Ask
    9·1 answer
  • 4. Use the information under the Nutrients That the Human Body Needs title to create a multilevel list. Your list should meet th
    8·2 answers
  • Which function would you use to make sure all names are prepared for a mailing label? TODAY UPPER PROPER LOWER
    11·1 answer
  • If you have an ordered list of all the states in North America, and you want to add a title "States of North America", what tag
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!