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
I damaged a k12 laptop. do I have to pay for the damage? and if so how much?
Gnesinka [82]

You explain your situation, they send you a new computer, then mail to them the broken computer and later pay a $200-350 dollar fee. I think it depends on how much damage you made to it.

5 0
3 years ago
How did New York Governor Hugh Carey handle Sostre’s situation?
Ira Lisetskai [31]

Answer:

The governor found a way to free Sostre without assessing whether or not he was guilty or innocent of drug crime in buffalo.

Explanation:

4 0
2 years ago
Read 2 more answers
You have informed your users that you need to bring the machine down at the end of the day to perform routine maintenance. Howev
PSYCHO15rus [73]

Answer:

shutdown -h +15 It is time for a shutdown!

Explanation:

In a work environment where there is an admin and users connected to the server when the admin wants to Give a 15-minute delay to allow users enough time to save their work data and logout from the system. the command above shuts down after 15 minutes delay and notifies the user with "It is time to shut down!".

8 0
3 years ago
Given an list of N integers, Insertion Sort will, for each element in the list starting from the second element: Compare the ele
Elena L [17]

Answer:

def insSort(arr):

ct=0;

for i in range(1, len(arr)):

key = arr[i]

j = i-1

while j >=0 and key < arr[j] :

arr[j+1] = arr[j]

j -= 1

ct=ct+1;

arr[j+1] = key

return arr,ct;

print(insSort([2,1]))

Output of the program is also attached.

8 0
3 years ago
The range of an area where users can access the Internet via high frequency radio signals transmitting an Internet signal from a
Alexandra [31]
A) hotspot
Bluetooth is for short distance and pan is Personal area networks (PANs) connect an individual's personal devices
8 0
3 years ago
Read 2 more answers
Other questions:
  • You want to deploy software using group policy. what is necessary before deciding to assign the software to your user accounts?
    11·1 answer
  • Which part of a formal email is optional
    6·2 answers
  • Name the contributions of Steve Jobs and Bill Gates, with respect to technology.
    5·1 answer
  • Your computer has a single hard disk w/ a single volume used by the C:\ drive. You have previously upgraded the disk to a dynami
    6·1 answer
  • How do you check how much space is left in current drive?
    9·1 answer
  • Computers help eliminate the repetitiveness of manual tasks. How can this benefit you in your overall career?
    9·2 answers
  • What is a 96.1791 weighted gpa in a 4.0 scale?
    8·1 answer
  • In this project you will write a set of instructions (algorithm). The two grids below have colored boxes in different
    9·2 answers
  • Which part of project management considers if employees will work at home or in the office?
    10·2 answers
  • Why computer known as tool of information​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!