Exercise 1.7.4: Remove From Line4 points
You are given an array of names of people who are in line for movie tickets. Use the remove element
to remove the first person from the line twice, as if you have just given them their tickets.

var line = ["Sam", "Lisa", "Laurie", "Bob", "Ryan"];
You should write a function to print everyone in line. Then print the line before and after removing the people.

The console should print this:

Sam, Lisa, Laurie, Bob, Ryan
Laurie, Bob, Ryan

When I run the program it does not match the desired result because I don't have spaces.

Respuesta :

Use the knowledge in computational language in python  to write a code with array of names of people who are in line for movie tickets.

How to define an array in python?

Arrays are similar data structures to Python lists, but not as flexible. In an array all elements must be of the same type, typically numeric, such as int or float. Also, the size of an array cannot be modified, unlike lists that can grow dynamically. In contrast, using arrays is much more efficient and makes it easier to compute large volumes of numerical data. This makes arrays particularly useful in scientific computing.

So in an easier way we have that the code is

function start(){

var line = \["Sam", "Lisa", "Laurie", "Bob", "Ryan"\];

for(var i = 0; i < line.length; i++)

{

if(i + 1 == line.length){

println(line[i]);

}else{

print(line[i] + ", ");

}

}

var elim = line.remove(1);

var elim2 = line.remove(0);

for(var i = 0; i < line.length; i++){

if(i + 1 == line.length){

print(line[i]);

}else{

print(line[i] + ", ");

}

}

}

See more about python at brainly.com/question/18502436

Ver imagen lhmarianateixeira