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
mestny [16]
3 years ago
11

What's wrong with this python code i don't know what's wrong with both of them

Computers and Technology
1 answer:
Evgesh-ka [11]3 years ago
5 0

Answer:

Keep it in the format

first one:

def swapping_stars():

   line_str = ""

   for line in range(6, 8):

       for char in range(0, 6):

           if line % 2 == char % 2:

               line_str = line_str + "*"

           else:

               line_str = line_str + "-"

           print(str(line_str))

swapping_stars()

second one:

if you want it to go:

23456

def print_numbers(list):

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

       print(str(list[i]))

num_list = [1, 2, 3, 4, 5, 6]

print_numbers(num_list)

if you want it to go

123456

def print_numbers(list):

   doneONE = False

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

       if not doneONE:

           print(str(list[i] - 1))

           doneONE = True

       print(str(list[i]))

num_list = [1, 2, 3, 4, 5, 6]

print_numbers(num_list)

Explanation:

You might be interested in
in 1970s British artist harlod Cohen created a computer program that could produce paintings, how did it impact present art
docker41 [41]
The computerization of art meant that certain details and intricacy could be done which previously had been impossible give the limitations of the human body.
6 0
3 years ago
One lap around a standard high-school running track is exactly 0.25 miles. Write the function miles_to_laps() that takes a numbe
Cerrena [4.2K]

def miles_to_laps(mi):

   return f"{mi} mile(s) is {mi/0.25} lap(s)"

print(miles_to_laps(1))

I wrote my code in python 3.8. I hope this helps!

6 0
3 years ago
What is a path and how do you know that it is filled and selected
Shkiper50 [21]

Explanation:

A path represents a selected editing area of an image, this feature is typically available when using Adobe Photoshop software.

For example, a photographer may select the entire face area of his subject as his path (work path). To know when it is filled the photographer observes to see when the colour changes or other changes are applied to the background layer of the selected path.

8 0
3 years ago
Using the program below, explain what the output will be at LINE A. 1 #include 2#include 3#include 4 5 int value - 128; 6 7 int
slega [8]

Answer:

This is the complete correct program:

#include <stdio.h>

#include<sys/types.h>

#include<unistd.h>

int value = 128;

int main()

{

  pid_t pid;

  pid=fork();

  if (pid==0) /* child process */

  {

  value +=8;

  return 0; }

  else if (pid > 0) {/* parent process */

 wait (NULL);

 printf ("PARENT: value =%d\n" ,value); /* LINEA */

 return 0;

}

}

The output of the LINE A is:

PARENT: value = 128

Explanation:

The fork() function used in the program creates a new process and this process is the child process. The child process is same as the original process having its own address space or memory.

In the child process the value of pid is 0. So the if condition checks if pid==0. Then the child process adds 8 to the value of its variable according to the following statement  

value +=8;

Now the original process has value = 128. In else if part the parents process has the value of pid greater than zero and this portion of the program is of the parent process :

else if (pid > 0)

{ wait (NULL);

printf ("PARENT: value =%d\n" ,value);

return 0; }

So the value 128 is printed at the end in the output.

wait(NULL) is used to wait for the child process to terminate so the parent process waits untill child process completes.

So the conclusion is that even if the value of the variable pid is changed in the child process but it will not affect the value in the variable of the parent process.

5 0
3 years ago
Which of the following tasks can you perform using a word processor?
frutty [35]

Answer:

check a document for spelling errors

Explanation:

With a word processor, you can easily edit and make changes to a document, move text around in a document, add images, change fonts, check for spelling errors

3 0
3 years ago
Other questions:
  • A _____ is a group of two or more devices/computers connected together to allow for the exchange and information and for the sha
    5·2 answers
  • The next thing Maria wants to do is to indent the first line of her paragraph how dose she do it
    10·2 answers
  • How does a hard drive work
    6·2 answers
  • Roark has just joined a company and in his role as a lead analyst, he will be responsible for determining which systems developm
    11·1 answer
  • You can use colors, patterns, and borders to enhance the overall appearance of a worksheet and to make it easier to read. One of
    11·1 answer
  • What menu and grouping commands is the "SORT" tool? ( please answering meeeee)
    9·1 answer
  • Write an algorithm to print the odd number from 100 to 1​
    13·1 answer
  • What is used for risk response control?
    7·1 answer
  • I don't want my large video files using up all my hard drive space . can i archive my videos in on dvds or blu rays?
    7·1 answer
  • Which of the following is not a reason to choose a community college?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!