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
Which presentation software element can you use to control the speed between slides in a presentation?
docker41 [41]

Answer:

d. transition

Explanation:

-Slide layout shows the design and formatting for everything you put in a slide.

-Video allows you to insert a video in the presentation.

-Animation allows you to put effects in the objects that you have in the presentation.

-Transition is the effect you can see in the presentation when you move from one slide to the other one and it helps you to control the speed.

According to this, the answer is that the presentation software element that you can use to control the speed between slides in a presentation is transition.

3 0
4 years ago
Read 2 more answers
HELP 100 points
natima [27]

Answer:

i do not know what to do there.

Explanation:

there's no pictures

5 0
2 years ago
After assembling a computer system the very first software to be installed is​
tatyana61 [14]

Answer:

operating system is the very first

after assembling a computer system the very first software to be installed is

8 0
4 years ago
Read 2 more answers
Web pages often have built-in connections, or links, to other documents, graphics, other web pages, or web sites. true or false?
yawa3891 [41]
Web pages often have built-in connections, or links, to other documents, graphics, other web pages, or web sites.

true
7 0
3 years ago
How many Megabytes are there in a Gigabyte?
Tju [1.3M]
<span>
In quantities of data,
"kilo" = 2^10 = 1,024
"mega" = 2^20 = 1,048,576,
"giga" = 2^30 = 1,073,741,824 .

<span> <span /></span></span> <span>1 gig = 1,024 megs<span><span /></span></span>


7 0
4 years ago
Other questions:
  • Are there any tips or helpful advice for people who want to learn Photoshop?
    10·1 answer
  • Which osi layer is responsible for combining bits into bytes and bytes into frames?
    8·1 answer
  • Jonas is an experienced security professional who recently accepted a position in an organization that uses Check Point firewall
    9·1 answer
  • How to see if your computer has bluetooth?
    6·1 answer
  • Which process refers to starting up a computer?
    13·2 answers
  • Write a statement that compares the values of score1 and score2 and takes the following actions. When score1 exceeds score2, the
    7·1 answer
  • If you can name this you get 15 points: ↑↑↓↓←→←→βα
    10·1 answer
  • g Write a function number_of_pennies() that returns the total number of pennies given a number of dollars and (optionally) a num
    7·1 answer
  • Draw a chart showing the crossing between red and white flowered pea plants till F2 generation. Find out the genotypic and pheno
    6·1 answer
  • What is the grooming process as it relates to online predators
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!