answer.
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
lorasvet [3.4K]
1 year ago
9

Initialize the list short_names with strings 'Gus', 'Bob', and 'Zoe'. Sample output for the given program:

Computers and Technology
1 answer:
ohaa [14]1 year ago
7 0

Answer:

Following are the correct code to this question:

short_names=['Gus','Bob','Zoe']#defining a list short_names that holds string value

print (short_names[0])#print list first element value

print (short_names[1])#print list second element value

print (short_names[2])#print list third element value

Output:

Gus

Bob

Zoe

Explanation:

  • In the above python program code, a list "short_names" list is declared, that holds three variable that is "Gus, Bob, and Zoe".
  • In the next step, the print method is used that prints list element value.
  • In this program, we use the list, which is similar to an array, and both elements index value starting from the 0, that's why in this code we print "0,1, and 2" element value.
You might be interested in
Clunker Motors Inc. is recalling all vehicles from model years 1995-1998 and 2004-2006. A boolean variable named recalled has be
AlekseyPX

Answer:

boolean recalled;

((modelYear>=1995 && modelYear <=1998) || (modelYear>=2004 && modelYear<=2006)) ? recalled =true : recalled =false;

Explanation:

In the first line of the code we declare the variable of type boolean (values can only be true or false) then using the conditional expression operator (ternary operator) in place of an if statement, We state the conditions of the years that will return true and vice versa

3 0
1 year ago
. Create a text file that contains your expenses for last month in the following categories: • Rent • Gas • Food • Clothing • Ca
Whitepunk [10]

Answer:

  1. from matplotlib import pyplot as plt
  2. with open("text.txt") as file:
  3.    data = file.readlines()
  4.    category = []
  5.    amount = []
  6.    for row in data:
  7.        values = row.split(" ")
  8.        category.append(values[0])
  9.        amount.append(float(values[1]))
  10.    
  11. figure = plt.figure()
  12. ax = figure.add_axes([0,0,1,1])
  13. ax.axis('equal')
  14. ax.pie(amount, labels = category, autopct='%1.2f%%')
  15. plt.show()

Explanation:

Firstly, we need to import matplotlib library (Line 1).

Next, open a file stream and use readlines method to read the data from the text file (Line 4). Presume the data read from the text files are as follows:

Rent 450

Gas 150

Food 500

Clothing 120

Car 600

Create two lists, category and amount (Line 5-6). Use a for loop to traverse through the read data and use split method to break each row of data into two individual items. The first item is added to category list whereas the second item is added to amount list (Line 7 - 10).

Next, create a plot figure and then add the axes (Line 12 - 13). We can use the pie method to generate a pie chart (Line 15) by setting the amount list as first argument and category list as value of labels attributes. The output pie chart can be found in the attachment.

7 0
2 years ago
Consider the following relation:CAR_SALE(Car#, Date_sold, Salesperson#, Commission%, Discount_amt)Assume that a car may be sold
GalinKa [24]

Answer:

The answer to this question can be given as:

Normalization:

Normalization usually includes the division of a table into two or more tables as well as defining a relation between the table. It is also used to check the quality of the database design. In the normalization, we use three-level that are 1NF, 2NF, 3NF.

First Normal Form (1NF):

In the 1NF each table contains unique data. for example employee id.  

Second Normal Form (2NF):

In the 2NF form, every field in a table that is not a determiner of another field's contents must itself be a component of the table's other fields.

Third Normal Form (3NF):

In the 3NF form, no duplication of information is allowed.

Explanation:

The explanation of the question can be given as:

  • Since all attribute values are single atomic, the given relation CAR_SALE is in 1NF.  
  • Salesperson# → commission% …Given  Thus, it is not completely dependent on the primary key {Car#, Salesperson#}. Hence, it is not in 2 NF.                                                                                                        

The 2 NF decomposition:

        CAR_SALE_1(Car#, Salesperson#, Date_sold, Discount_amt)

         CAR_SALE_2(Salesperson#, Commission%)

  • The relationship in question is not in 3NF because the nature of a transitive dependence occurs
  • Discount_amt → Date_sold → (Car#, Salesperson#) . Thus, Date_sold is neither the key itself nor the Discount amt sub-set is a prime attribute.  

The 3 NF decomposition :

        CAR_SALES_1A(Car#, Salesperson#, Date_sold)

        CAR_SALES_1B(Date_sold, Discount_amt)

        CAR_SALE_3(Salesperson#, Commission%)

5 0
1 year ago
Nathan wants to make the quotation stand out further. Which order of steps does he need to follow to do this task?
Alina [70]

Answer:

B.

Explanation:

Go to the Borders and Shading option, click the Shading tab, and click the color under the Fill option.

5 0
2 years ago
Read 2 more answers
Which of the following stakeholders makes policies for a green economy?
miskamm [114]

Answer:

government is the answer

7 0
2 years ago
Other questions:
  • Linda is making handouts for her upcoming presentation. She wants the handouts to be comprehensible to people who do not attend
    12·2 answers
  • Suppose the information content of a packet is the bit pattern 1110 0110 1001 1101 and an even parity scheme is being used. What
    15·1 answer
  • Write a class with a constructor that accepts a String object as its argument. The class should have a method that returns the n
    13·1 answer
  • The results of the spec cpu2006 bzip2 benchmark running on an amd barcelona has an instruction count of 2.389e12, an execution t
    13·1 answer
  • Write a do-while loop that continues to prompt a user to enter a number less than 100, until the entered number is actually less
    10·2 answers
  • Nathan would like to save his PowerPoint presentation as a video that can be replayed easily on any device at full quality. Whic
    14·1 answer
  • A laptop gets replaced if there's a hardware issue. Which stage of the hardware lifecycle does this scenario belong to?
    5·1 answer
  • The web development team is having difficulty connecting by ssh to your local web server, and you notice the proper rule is miss
    8·1 answer
  • 1.the following code example would print the data type of x, what data type would that be?
    12·1 answer
  • Accenture has partnered with a global construction company that specializes in building skyscrapers. The company wants better ma
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!