Write code to create a list of numbers from 0 to 67 and assign that list to the variable nums. Do not hard code the list. Save & RunLoad HistoryShow CodeLens

Answers

Answer 1

Answer:

The program written in Python is as follows

nums = []

for i in range(0,68):

-->nums.append(i)

print(nums)

Explanation:

Please note that --> is used to denote indentation

The first line creates an empty list

nums = []

This line creates an iteration from 0 to 67, using iterating variable i

for i in range(0,68):

This line saves the current value of variable i into the empty list

nums.append(i)

At this point, the list has been completely filled with 0 to 67

This line prints the list

print(nums)


Related Questions

What are the pros and cons of using a linked implementation of a sparse matrix, as opposed to an array-based implementation?

Answers

Answer:

Linked lists and arrays are both linear data structures but while an array is a collection of items that can be accessed randomly, a linked list can be accessed sequentially.

A sparse matrix contains very few non-zero elements. For example;

_                        _

|  0   0   3  0  6    |

|   0   5   0  0  4   |

|   2   0   0  0  0   |

|_ 0   0   0  0  0 _|

In the implementation of a sparse matrix, the following are some of the pros and cons of using a linked list over an array;

PROS

i.  Linked lists are dynamic in nature and are readily flexible - they can expand and contract without having to allocate and/or de-allocated memory compared to an array where an initial size might need to be set and controlled almost manually. This makes it easy to store and remove elements from the sparse matrix.

ii. No memory wastage. Since the size of a linked list can grow or shrink at run time, there's no memory wastage as it adjusts depending on the number of items it wants to store. This is in contrast with arrays where you might have unallocated slots. Also, because the zeros of the sparse matrix need not be stored when using linked lists, memory is greatly conserved.

CONS

i. One of the biggest cons of linked lists is the difficulty in traversing items. With arrays, this is just of an order of 0(1) since the only requirement is the index of the item. With linked lists, traversal is sequential which means slow access time.

ii. Storage is another bottle neck when using linked lists in sparse matrix implementation. Each node item in a linked list contains other information that needs to be stored alongside the value such as the pointer to the next or previous item.

4. Discuss the advantages and disadvantages of using the same system call interface for both files and devices. Why do you think operating system designers would use the same interface for both

Answers

Answer:

According to the principles of design, Repetition refers to the recurrence of elements of the design

One of the advantages of this is that it affords uniformity. Another is that it keeps the user of such a system familiar or with the interface of the operating system.

One major drawback of this principle especially as used in the question is that it creates a familiar route for hackers.

Another drawback is that creates what is called "repetition blindness". This normally occurs with perceptual identification tasks.

The  phenomenon may be  due to a failure in sensory analysis to process the same shape, figures or objects.

Cheers!

Write a program that create Employee class with fields id,name and sal and create Employee object and store data and display that data.

Answers

Answer:

Here is the C++ program for Employee class with fields id,name and sal.

#include <iostream>  // to use input output functions

#include <string>  //to manipulate and use strings

using namespace std;   // to access objects like cin cout

class Employee {  //class Employee

private:  

/* the following data members are declared as private which means they can only be accessed by the functions within Employee class */

  string name;  //name field

  int id; //id field

  double sal;   //salary field

public:    

  Employee();  // constructor that initializes an object when it is created

/* setName, setID and setSalary are the mutators which are the methods used to change data members. This means they set the values of a private fields i.e. name, id and sal */

  void setName(string n)  //mutator for name field

     { name = n; }        

  void setId(int i)  //mutator for id field

     { id = i; }        

  void setSalary(double d)  //mutator for sal field

     { sal = d; }  

/* getName, getID and getSalary are the accessors which are the methods used to read data members. This means they get or access the values of a private fields i.e. name, id and sal */

  string getName()  //accessor for name field

     { return name; }        

  int getId()  //accessor for id field

     { return id; }        

  double getSalary()  //accessor for sal field

     { return sal; }  };  

Employee::Employee() {  //default constructor where the fields are initialized

  name = "";  // name field initialized

  id = 0;  // id field initialized to 0

  sal = 0;   }   // sal field initialized to 0

void display(Employee);  

// prototype of the method display() to display the data of Employee

int main() {  //start of the main() function body

  Employee emp;  //creates an object emp of Employee class

/*set the name field to Abc Xyz which means set the value of Employee class name field to Abc Xyz  through setName() method and object emp */

  emp.setName("Abc Xyz");  

/*set the id field to 1234 which means set the value of Employee class id field to 1234  through setId() method and object emp */

  emp.setId(1234);

/*set the sal field to 1000 which means set the value of Employee class sal field to 1000  through setSalary() method and object emp */

  emp.setSalary(1000);    

  display(emp);  }   //calls display() method to display the Employee data

void display(Employee e) {  // this method displays the data in the Employee //class object passed as a parameter.

/*displays the name of the Employee . This name is read or accessed through accessor method getName() and object e of Employee class */

  cout << "Name: " << e.getName() << endl;  

/*displays the id of the Employee . This id is read or accessed by accessor method getId() and object e */

  cout << "ID: " << e.getId() << endl;

/*displays the salary of the Employee . This sal field is read or accessed by accessor method getSalary() and object e */

  cout << "Salary: " << e.getSalary() << endl;  }

Explanation:

The program is well explained in the comments mentioned with each statement of the program.

The program has a class Employee which has private data members id, name and sal, a simple default constructor Employee(), mutatator methods setName, setId and setSalary to set the fields, acccessor method getName, getId and getSalary to get the fields values.

A function display( ) is used to display the Employee data i.e. name id and salary of Employee.

main() has an object emp of Employee class in order to use data fields and access functions defined in Employee class.

The output of the program is:

Name: Abc Xyz                                                                                                      

ID: 1234                                                                                                                  

Salary: 1000

The program and its output are attached.

Other Questions
Read the following paragraph and then answer the question that follows:Video games can kill! That is what many who support legislation banning violent titles from underage players have stated. These supporters of video game reform cite studies that show increased statistics of violence among children who play games regularly at home. Opponents of this reform, however, have expressed doubts about the validity of the studies, requesting that further research be done before a dramatic statement is made about all gamers. It seems that the rising popularity of video games among youth has spiked a political debate that may last for several more years to come.Which sentence from this paragraph is an example of the support?A) These supporters of video game reform cite studies that show increased statistics of violence among children who play games regularly at home.B) That is what many who support legislation banning violent titles from underage players have stated.C) Video games can kill!D) It seems that the rising popularity of video games among youth has spiked a political debate that may last for several more years to come. Can somebody please help me!! What is a non-civic issue? In "Life Without Go Go Boots, what evidence does Kingsolver use to support her claim that her profession justifies her fashion choices in the eyes of society?A) So many have so little.B) Artists make very little money. C) Style trumps fashion.D) Artists have more important things to think about. whats 1/2 + 2/4 - 5/8? How did the French and British differ in the tactics they used to control their empires in Asia? O A. The British ruled directly over their colonies, while the French did not. B The French offered native peoples new technologies, while the British did not O The British forced their colonies to export goods, while the French did not D. The French used violence to control their colonies, while the British did not. The sum of three numbers is 84 The second number is 2 times the first. The third number is 16 less than the second. What is the second number? I need help on this question will give brainly points must be right. For A (1, -1), B(-1,3), and C(4, -1), find a possible location of a fourth point, D, so that aparallelogram is formed using A, B, C, D in any order as vertices. A student throws a 120 g snowball at 7.5 m/s at the side of the schoolhouse, where it hits and sticks. What is the magnitude of the average force on the wall if the duration of the collision is 0.15 s This campaign ad was made to_______ a political candidate named Matt Myers. the central idea in this ad is ______. According to the text, the ad was paid for by PAC that most likely_______ this as best described as_____. Suppose a random variable X is best described by a uniform probability distribution with range 1 to 5. Find the value of that makes the following probability statements true.a) P(X a)= 0.89e) P(X >a)= 0.31 A lake near the Arctic Circle is covered by a 222-meter-thick sheet of ice during the cold winter months. When spring arrives, the warm air gradually melts the ice, causing its thickness to decrease at a constant rate. After 333 weeks, the sheet is only 1.251.251, point, 25 meters thick. A Slope and xxx-intercept (Choice B) B Slope and yyy-intercept (Choice C) C Slope and a point that is not an intercept (Choice D, Checked) D xxx-intercept and yyy-intercept (Choice E) E y-intercept and a point that is not an intercept (Choice F) F Two points that are not intercepts Which equation has the steepest graph?A. y = 10x-5B. y=3/4x-9c. y = -14x+1D. y = 2x + 8 Amir wants to buy a $1382 Apple iPhone that is 12% off. What is 1 pointthe discounted price before tax? * Is (0,-2) a solution of 3x - y = 2? Fiona's school is in the shape of a triangle, with three hallways connecting the corners. Fiona enters the building and walks 90 yards through the first hallway to the first corner. Then, she walks 60 yards through the second hallway to the second corner. A triangle is shown. The side lengths are 60 yards, 90 yards, and question mark. The top point is labeled exit and the bottom right point is labeled entrance. The distance between exit and entrance is question mark. What are the possible lengths of the third hallway? between 30 yards and 60 yards between 30 yards and 90 yards between 30 yards and 120 yards between 30 yards and 150 yards Use las pistas para descifrar las siguientes palabras relacionadas con la ciudadana global EN INGLES. a. C R O O A L B T E A L (To work together) b. Y E T D I S R V I (Inclusion from different types of people) c. L A L B G O (Opposite of local) d. L N T P A E (Earth is one, Mars is another) e. L E R I O S S I Y N P I T B (Do you like ______ for your actions?) f. SI R H G T (Dr. Martin Luther King Jr. fought for civil ______.) g. K A S T E A O I C N T (A global citizen ______ to improve the world.) ASAP!! Please help me. I will not accept nonsense answers, but will mark as BRAINLIEST if you answer is correctly with solutions. A furniture store has set aside 800 square feet to display its sofas and chairs. Each sofa utilizes 50 sq. ft. and each chair utilizes 30 sq. ft. At least five sofas and at least five chairs are to be displayed. a. Write a mathematical model representing the store's constraints. b. Suppose the profit on sofas is $200 and on chairs is $100. On a given day, the probability that a displayed sofa will be sold is 0.03 and that a displayed chair will be sold is 0.05. Mathematically model each of the following objectives: 1. Maximize the total pieces of furniture displayed. 2. Maximize the total expected number of daily sales. 3. Maximize the total expected daily profit.