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
Vlad1618 [11]
2 years ago
8

In evaluating the precedence rules used by Python, what statement is accurate? a. Addition and subtraction are evaluated after a

ssignment. b. Exponentiation and assignment operations are left associative. c. Exponentiation has the highest precedence. d. Multiplication is evaluated before unary multiplication.
Computers and Technology
2 answers:
Mama L [17]2 years ago
7 0

Answer:

None of the statement a to d can be considered accurate because for:

a) Since assignment is Non associative operator in python, addition and subtraction will be evaluated first before assignment.

b) While Exponent operator has right-to-left associativity in Python, assignment do not have associativity. therefore, both of them are not left associative

c) The operator with highest precedence is Parentheses not Exponentiation

d) The statement is false because it is correct to say "Multiplication have higher precedence than addition and subtraction" and therefore evaluated first, not unary multiplication  

Explanation:

Precedence in Python

Precedence guides the order in which operation are carried out in python.

for example

in 8 - 4 * 2, multiplication is evaluated first because it has higher precedent than subtraction.

Although, the order can be changed using Parentheses ().

example in (10 -4) * 2

values inside Parentheses will be evaluated first.

Associativity of Python operators

Associativity is the order in which an expression that has multiple operator of the same precedence is evaluated .

for example, multiplication ( * ) and floor division ( // ) have same precedence.

Almost all the operators have left-to-right associativity.

Note: operators precedence can be found online in tabular form in the Python documentation

tatyana61 [14]2 years ago
4 0

Answer:

c. Exponentiation has the highest precedence.

Explanation:

Operator precedence decides how an expression is evaluated. For example, Multiplication has higher precedence than addition, therefore a+b*c will be evaluated as a + (b*c). (expression in bold is evaluated first, then added to a)

Option a is wrong since assignment ( = ) has the lowest precedence, therefore addition and subtraction will be evaluated first.

Option b is wrong since exponentiation is right associative.

Option d is wrong because multiplication can never be unary.

Precedence of basic python operators is listed below (Order Highest to lowest):

1) Exponentiation (**)

2) Multiplication (*) , Division (/), Modulus (%). (Same rank means equal precedence)

3) Addition (+), Subtraction(-)

You might be interested in
You have been tracking your exercise routine, which involves running, lifting weights, yoga, and stretching. You want to see wha
Harrizon [31]

The best chart to see the data distribution for the exercise routine would be a pie chart. Using Microsoft Excel, you can input each data point you have for all you exercise routine category, and generate a pie chart which will show you the percentage for each category in comparison to the total.


5 0
2 years ago
Read 2 more answers
"There are no longer mature industries; rather, there are mature ways of doing business," he is referring to the high demand of
yanalaym [24]

Hi, you've asked an incomplete and unclear question. However, I provided the full text below.

Explanation:

The text reads;

<em>"When Porter says “There are no longer mature industries; rather, there are mature ways of doing business,” he is referring to the high demand for creativity and innovation in the market. Earlier we used to be more concerned about the hardware and the physical product rather than its information content, But now as a business, we need to provide more informative content with the product.</em>

<em>Like General Electric offers dedicated customer service for its line of goods which differentiates it from its rivals. Similarly, shipping companies like UPS now offer us to track the location of our package on a live map. This is what we call a mature business and how we can differentiate ourselves and stand out in the highly competitive market by using Information and Technology..."</em>

4 0
2 years ago
ArgumentException is an existing class that derives from Exception; you use it when one or more of a method’s arguments do not f
dybincka [34]

Answer:

The C# code is given below

Explanation:

using System;

public class SwimmingWaterTemperatur

{

public static void Main()

{

while(true){

Console.Write("\nPlease enter the water temperature : ");

int x = Int32.Parse (Console.ReadLine());

try{

if(CheckComfort(x)){

Console.Write(x+" degrees is comfortable for swimming.");

}else{

Console.Write(x+" degrees is not comfortable for swimming.");

}

}catch(Exception ex){

Console.WriteLine(ex);

}

}

}

public static Boolean CheckComfort(int temp){

if(temp>=70 && temp<=85){

return true;

}else if(temp>=32 && temp<=212){

return false;

}else{

throw new ArgumentException("Value does not fall within the exptected range.");

}

}

}

7 0
2 years ago
The establishment called ABC Enterprise requires a Java program to keep a database of the inventory of the products that it sell
Alexandra [31]

Answer:

// GetData.java

import javax.swing.JOptionPane;

public class GetData

{

  public static double getDouble(String s)

  {

      return Double.parseDouble(getWord(s));

  }

  public static int getInt(String s)

  {

      return Integer.parseInt(getWord(s));

  }

  public static String getWord(String s)

  {

      return JOptionPane.showInputDialog(s);

  }

  public static String getString(String s)

  {

      return JOptionPane.showInputDialog(s);

  }

}

// Address.java

public class Address

{

  private String street, city, state, zip;

  public Address(String str, String city, String st, String zip)

  {

      street = str;

      this.city = city;

      state = st;

      this.zip = zip;

  }

  public String getStreet()

  {

      return street;

  }

 

  public String getCity()

  {

      return city;

  }

  public String getState()

  {

      return state;

  }

  public String getZip()

  {

      return zip;

  }

}

// Manufacturer.java

public class Manufacturer

{

  private String companyName;

  private Address companyAddress;

 

  public Manufacturer()

  {

      this.companyName = "";

      this.companyAddress = null;

  }

 

  public Manufacturer(String compName, Address address)

  {

      this.companyName = compName;

      this.companyAddress = address;

  }

 

  public String getCompanyName()

  {

      return companyName;

  }

 

  public void setCompanyName(String companyName)

  {

      this.companyName = companyName;

  }

 

  public Address getCompanyAddress()

  {

      return companyAddress;

  }

 

  public void setCompanyAddress(Address address)

  {

      this.companyAddress = address;

  }

}

// Product.java

import java.text.SimpleDateFormat;

import java.util.Date;

public class Product

{

 

  SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");

 

 

  Manufacturer manufacture;

 

 

  String productName;

 

 

  int quantity;

 

 

  double unitPrice;

 

 

  Date productCreated;

 

 

  public Product()

  {

      this.productName = "";

      this.quantity = 0;

      this.unitPrice = 0.0;

      this.productCreated = null;

      this.manufacture = null;

  }

 

  public Product(String prodName, int quantity, double unitPrice,

                        Date productCreated, Manufacturer manufact)

  {

      this.productName = prodName;

      this.quantity = quantity;

      this.unitPrice = unitPrice;

      this.productCreated = productCreated;

      this.manufacture = manufact;

  }

 

 

  public Date getProductCreated()

  {

      return productCreated;

  }

 

 

  public void setProductCreated(Date productCreated)

  {

      this.productCreated = productCreated;

  }

 

  // to get the Manufacturer object

  public Manufacturer getManufacture()

  {

      return manufacture;

  }

 

  // to set the Manufacturer object

  public void setManufacture(Manufacturer manufacture)

  {

      this.manufacture = manufacture;

  }

 

  // to get the name of the product

  public String getProductName()

  {

      return productName;

  }

 

  // to set the name of the product

  public void setProductName(String prodName)

  {

      this.productName = prodName;

  }

 

  // to get the quantity of the product

  public int getQuantity()

  {

      return quantity;

  }

 

  // to set the quantity of the product

  public void setQuantity(int quantity)

  {

      this.quantity = quantity;

  }

 

  // to get the unit price of the product

  public double getUnitPrice()

  {

      return unitPrice;

  }

 

  // to set the unit price of product

  public void setUnitPrice(double unitPrice)

  {

      this.unitPrice = unitPrice;

  }

 

  // to update the quantity of the product

  public void upDateQuantity(int quantity_upDate)

  {

      quantity += quantity_upDate;

  }

 

  // to update the price of the product

  public void upDatePrice(double price_upDate)

  {

      this.unitPrice = price_upDate;

  }

 

 

  public String getProductInfomation()

  {

      String result = "";

      result += String.format("%-30s", productName);

      String dateForm = sdf.format(productCreated);

      result += String.format("\t %s", dateForm);

      result += String.format("%10d", quantity);

      result += String.format("\t%15.2f", unitPrice);

      result += String.format("\t%15s",

                          manufacture.getCompanyName());

      result += String.format("\t%20s",

                 manufacture.getCompanyAddress().getState());

      return result;

  }  

}

Explanation:

  • Create a manufacturer class to store and get information about company name and company address.
  • Create a product class to hold the manufacturer object, product name and other relevant information.
4 0
2 years ago
Susie works for an architectural firm and the partners have always drawn the plans for projects by hand. Though Susie learned ho
lidiya [134]

Answer:

The correct answer to the following question will be CAD.

Explanation:

CAD - It stands for Computer-aided Design. CAD is a software used for creating some 3D designs, creative drawing or some technical illustrations and is basically used by the engineers and artists.

Many projects based on electronic can be designed with the help of this software, electronic parts like circuit boards, etc.

Various types of CAD are as follows :

  • 2D (Two dimensional)
  • 3D (Three dimensional)
  • 3D wire frame
  • Solid modeling

This enables efficiency in design's quality, also increase in engineer and artist's productivity. So, many of the computer programs should recommend the Computer-aided design software to there project partners for some 3D and effective look on their project.

3 0
2 years ago
Other questions:
  • Foods that are high in _________ have the least impact on slowing the body's absorption rate of alcohol.
    5·1 answer
  • What critical issue in symmetric and asymmetric encryption is resolved by using a hybrid method like diffie-hellman?
    5·2 answers
  • Mark’s friends told him about an automated program that sends unsolicited messages to multiple users. Which type of program were
    11·2 answers
  • Grabar microphone audio icon_person click each item to hear a list of vocabulary words from the lesson. then, record yourself sa
    7·2 answers
  • Jesse would like to modify the table that he has inserted into a Word document by making the first row a single header cell.
    15·2 answers
  • Programming challenge description: Write a program that, given two binary numbers represented as strings, prints their sum in bi
    6·1 answer
  • Suppose that you need to maintain a collection of data whose contents are fixed- i.e., you need to search for and retrieve exist
    8·1 answer
  • You're the sole IT employee at your company. Most of the computers in your fleet are Windows machines. Your boss wants you to se
    11·1 answer
  • Consider the following network: proxy-cache On average there are 35 objects downloaded per second, and the average object size i
    14·1 answer
  • Write a function that takes a string like 'one five two' and returns the corresponding integer (in this case, 152). A function j
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!