Question

I. Give an example of 2. List operators for arithmetic expressions in python. 3 Give an eample on expression in python 4. List operators for rational/boolean expression in python. 5. Is there any type conversion in the following expression, and why? 9/3.0 Please answer all questions
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1.arithmatic operators in python:

2.

+ ----- unary plus that add two operands

Example: A+B

- ----- unary minus that subtract right operand from left operand

Example: A-B

*   ----- multiply two operands

Example: A*B

/ ----- divide left operand by the right operand

Example: A/B

% ------ remainder of the division of left operand by the right

Example: A%B

// ------ floor division - division that results into whole number adjusted to the left in the number line

Example: A // B

** ------- Exponent - left operand raised to the power of right

Example: A**B

3. rational/boolean expression in python

4.

> ---- greater than----> true if left operand is greater than

Example: A > B

< ---- less than ----> true if right operand is greater than

Example: A < B

== ---- equal ---- >true if both operands are equal

Example: A==B

!= ----- not equal ---->true if both operands are not equal

Example: A!=B

> = -----greater than or equal ------> returns true if left operand is greater than or equal to right operand

Example: A>=B

<= ----- less than or equal -------> true : if left operand is less than or equal to right operand

Example: A<=B

5.

in the calculation of 9/3.0 , 9 is integer and 3.0 is floating data type while calculating this we get the result as 3.0 means it implicitly converts data type

Add a comment
Know the answer?
Add Answer to:
Please answer all questions I. Give an example of 2. List operators for arithmetic expressions in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Can you please explain what does each sentence mean and give an example if it’s possible?....

    Can you please explain what does each sentence mean and give an example if it’s possible?. I need to have answers for all of them please Assignment Statements- Input- cin >> Output--cout << endl<"n" Output formatting Arithmetic operators +-'* / % Relational Operators-=-= ++- Logical Operators ! && II Evaluating Expressions of mixed type Evaluating Boolean Expressions Type Conversion, Implicit Coersion Explicit-Type Casting Control Structure: Sequence, decision (branching), looping (repetition) if, if-else, if/else-if/else, nested ifs switch statement conditional statement while...

  • EVALUATING GENERAL INFIX EXPRESSIONS INTRODUCTION The notation in which we usually write arithmetic expressions is called infix notation;...

    EVALUATING GENERAL INFIX EXPRESSIONS INTRODUCTION The notation in which we usually write arithmetic expressions is called infix notation; in it, operators are written between their operands: X + Y. Such expressions can be ambiguous; do we add or multiply first in the expression 5 + 3 * 2? Parentheses and rules of precedence and association clarify such ambiguities: multiplication and division take precedence over addition and subtraction, and operators associate from left to right. This project implements and exercises a stack-based algorithm that evaluates...

  • Python Activity 05 Boolean Expressions - POGIL (5) - Word Search m Layout References Mailings Review...

    Python Activity 05 Boolean Expressions - POGIL (5) - Word Search m Layout References Mailings Review View Help Critical Thinking Questions Programming Structures Sequence Structure Decision or Branching Structure Looping Structure FALSE Which structure best describes the types of Python programs you have written so far? _sequence structure Which structure allows the programmer to create code that decides what code is executed? FYI: Conditional operators, also known as relational operators, are used to compare the relationship between two operands. Expressions...

  • 3. Consider the following BNF for arithmetic expressions: <expression> ::= <term> <term>+ <expression> | <term> -...

    3. Consider the following BNF for arithmetic expressions: <expression> ::= <term> <term>+ <expression> | <term> - <expression> <term> ::= <factor> | <factor> * <term> | <factor> I <term> <factor> ::= <constant> (<expression>) <constant ::= 0|1|2|3|4|5|6789 a) Show the expression tree of the following expression: 8/7*5/6-6/4/2-7*(5+2). b) Give the value of this expression. c) Same question as (a), if the BNF were <expression> ::= <term> | <expression>+ <term> | <expression> - <term> <term> ::= <factor> | <term>*<factor> | <term> / <factor>...

  • QUESTION 2 Boolean or "truth-valued" expressions are how we express conditions that control choices and repetition...

    QUESTION 2 Boolean or "truth-valued" expressions are how we express conditions that control choices and repetition in computer languages. Consider the following Python Boolean expression, where variables alpha, beta, and gamma are of type Boolean: alpha and (beta or gamma) In any algebraic notation there are usually several different ways of writing the same expression. For instance, in integer arithmetic the value of expression '4 x (5 + 2)' is numerically equivalent to that of expression '(4 x 5) +...

  • Haskell coding problem please do the last 3 Problem One (Non-Polymorphic Type Inference): Give the type of the followin...

    Haskell coding problem please do the last 3 Problem One (Non-Polymorphic Type Inference): Give the type of the following expressions. We assume that we can have Integer and Bools as defined in the Haskell Prelude. Assume that all arithmetic operators in these examples operate only on Integers, so the type of (+) is Integer->Integer -» Integer. data D a = A Integer | B Bool | C a data Pair a b = Pab data List aNil | Cons a...

  • Please answer both questions and provide labeled answers. I give thumbs up for correct answers 2....

    Please answer both questions and provide labeled answers. I give thumbs up for correct answers 2. [-/1 Points] DETAILS GHCOLALG12 4.6.028. MY NC Find the domain of the rational function. Do not graph the function. (Enter your answer using interval notation.) 9x2 - x + 7 f(x) x4 + 8 3. (-/1 Points) DETAILS GHCOLALG12 4.6.036. MY NOTES ASK YOUR TEACHER PRACTICE ANOTHER Find the vertical asymptotes, any of the rational function. Do not graph the function (Enter your answers...

  • Assignment4: Evaluate Arithmetic Expressions. Requirements: Implement a concrete ArrayStack class that extends the IStack interface as...

    Assignment4: Evaluate Arithmetic Expressions. Requirements: Implement a concrete ArrayStack class that extends the IStack interface as we discussed in the class (any other different Stack class implementation, even if it is implemented by yourself, will not receive any credit). Write a test class called Evaluate and a method that evaluates an arithmatic expression, which is given by a string. import java.util.Scanner; public class Evaluate { public static void main(String[] args) } // your implementation // obtain user's input from keyboard...

  • ANSWER ALL THE QUESTIONS IF YOU ANSWER FIRST FOUR CERTAINLY I WILL GIVE DISLIKES 1. 2....

    ANSWER ALL THE QUESTIONS IF YOU ANSWER FIRST FOUR CERTAINLY I WILL GIVE DISLIKES 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.

  • 1. Prompt the user for one of the arithmetic operators ('op'): +, -, *,/, or **...

    1. Prompt the user for one of the arithmetic operators ('op'): +, -, *,/, or ** 2. Prompt the user for two input integers ('a' and'b') 3. The input numbers can be positive or negative 4. Perform the arithmetic operation using the two input numbers 5. The first entered number ('a') is the left side, the second ('b') the right side of the operation For exponentiation, the first number is the base, the second the exponent Print (display) the following...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT