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
GoInternet, Inc., is an Internet-access service provider that is being forced to manage numerous unwanted e-mail messages from a
marissa [1.9K]

Answer:

The correct answer to the following question is option b.)sends messages involving products of companies previously sued under the CAN-SPAM Act.

Explanation:

This act is an act of Controlling the Assault of Non-Solicited Marketing And Other things.

It is the law that establish the rules for the commercial message and the commercial e-mails, gives recipients right to have the business stops emailing them, and they outline the penalties incurred for those person who has violated the law.

8 0
3 years ago
Fifty-three percent of U.S households have a personal computer. In a random sample of 250 households, what is the probability th
aleksley [76]

Answer:

The correct Answer is 0.0571

Explanation:

53% of U.S. households have a PCs.

So, P(Having personal computer) = p = 0.53

Sample size(n) = 250

np(1-p) = 250 * 0.53 * (1 - 0.53) = 62.275 > 10

So, we can just estimate binomial distribution to normal distribution

Mean of proportion(p) = 0.53

Standard error of proportion(SE) =  \sqrt{\frac{p(1-p)}{n} } = \sqrt{\frac{0.53(1-0.53)}{250} } = 0.0316

For x = 120, sample proportion(p) = \frac{x}{n} = \frac{120}{250} = 0.48

So, likelihood that fewer than 120 have a PC

= P(x < 120)

= P(  p^​  < 0.48 )

= P(z < \frac{0.48-0.53}{0.0316}​)      (z=\frac{p^-p}{SE}​)  

= P(z < -1.58)

= 0.0571      ( From normal table )

6 0
3 years ago
Brake fluid is made up of a chemical that:
TEA [102]

A) IS MOSTLY JUST ENGINE Oil.

7 0
3 years ago
Read 2 more answers
What is software piracy
Tju [1.3M]
Software piracy is the illegal copying, distribution, or use of software.
8 0
3 years ago
Read 2 more answers
Icon view, list view, and details view are all common views provided by which kind of program?
RideAnS [48]
The standard program that uses common views such as the icon view, list view, and details view would be the program known as "File Explorer" (Windows) or "Finder" (Mac). This program uses all the views to make selecting and tracking down certain files a much more painless and easier process to complete.

Hope this helps and good luck! :)
6 0
3 years ago
Read 2 more answers
Other questions:
  • Some files appear dimmed in one of the default folders on your computer. What would be the best course of action? A. Leave the f
    11·1 answer
  • To set up a slide show you should do all of the following except ______.
    9·1 answer
  • Corey is an architect. What software does he most likely use to design houses? graphic software scheduling software CAD software
    10·2 answers
  • _______________________ is a short-term program, typically 30 hours long, in which a therapist, social worker, or trained probat
    5·1 answer
  • One of the attributes in a table in your database depends on another attribute for its meaning. What type of dependency has been
    14·1 answer
  • Unix is called a(n) ___________ operating system because it can run on a desktop pc or a server. operating systems installed on
    7·1 answer
  • Industry experts estimate about what percentage of communication is through body language?
    11·2 answers
  • What do Business Analysis workers do? Check all that apply.
    15·2 answers
  • List three different sets of keywords that could be used to search for information on how to
    15·1 answer
  • A row-level trigger requires use of the _____ keywords and is executed once for each row affected by the triggering statement.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!