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
What are the features of G-mail <br><br>(Write in your own words)​
wlad13 [49]

Answer:

here is what I think!

Explanation:

G-mail is:

  1. secure
  2. easy to use
  3. fast
  4. can be used to sign in anywhere!<u>(including brainly)</u>
  5. you don't need to pay when creating one
  6. can help you in billing and buying apps and their paid product
  7. <em><u>you </u></em> can use it because <em>why no!</em>
  8. some websites need G-mail to be used

thats why you should use G-mail

tell me if you have an idea!

3 0
3 years ago
Read 2 more answers
. Which game was the most popular free download in Apple®’s app store by January 2014, despite poor reviews and plagiarism accus
Brilliant_brown [7]
Flappy bird for the first question

7 0
3 years ago
Read 2 more answers
____________________ memory is the ability to add RAM without shutting down the computer or operating system.
Liula [17]

Answer:

Hot-add

Explanation:

The computer system is a electronic device that is used to perform computational task on input data for a pre-dertermined result. The components of the computer is divided into hardware and software components.

The hardware components are the physical parts of the computer system, while the software component are the instructions that runs the system.

The RAM is a physical component that provides memory for running current activities on the monitor screen. When it is removed or faulty, the screen goes blank. To add more RAM memory to the system while the system is on, activate the hot-add memory settings.

4 0
3 years ago
Look at the options below. Which one is a simulation?
Elena-2011 [213]

Im going to guess the 2nd one.

The 1st one just shows how trees can make ____ and then goes to water, the sun, then the rain but it CAN be used as one.

The 2nd one seems to explain the best it can show about weather, water, landforms, the sun, and seems like a better one to choose.

5 0
3 years ago
Whats happens when you add the numbers 1 and 1 together (1+1)<br> 11<br> 32<br> 2<br> 9
Neko [114]

Answer:

2

Explanation:

The mathematical answer would be 2. To get 11, one would simply put the 1's next to each other but there is an addition symbol. 32 is an irrational number to think of for an answer because there are no other numbers to add or multiply with the 1's to achieve 32. 9 is also irrational for the same reason.

6 0
2 years ago
Other questions:
  • someone who protects valuable online information, like phone numbers and passwords would be considered​
    8·1 answer
  • I have tried installing "windows media player" on my computer but at a point, something disrupts its instalment or I am asked to
    7·1 answer
  • An instance variable name of type String, initialized to the empty String. An instance variable score of type int, initialized t
    8·1 answer
  • @anthonydboss23<br><br> it’s goldielove6 <br><br> .....this is not a question everyone ignore this
    11·2 answers
  • Simplify the Boolean expression AB+(AC)`+AB`C(AB+C)
    13·1 answer
  • The definition of network is:
    10·1 answer
  • Question #3
    12·1 answer
  • 2. Select the things you can do when working with rows in columns in a spreadsheet:
    5·1 answer
  • The output of a computer can be seen on ( monitor, keyboard or mouse )​
    5·2 answers
  • Which of the following is Microsoft Windows 10 virtualization technology?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!