Question

1. Evaluate the following expressions if p = 8, 9 = 3, and the value of the variable found is False. Show your work. . q <= p8. Branching statements used for input validation: a) Prompt the user to enter a temperature between 60 and 80, inclusive. Pe

0 0
Add a comment Improve this question Transcribed image text
Answer #1

These are Multiple Questions. Solving as per the HOMEWORKLIB RULES the first problem (Question number - 1). Please ask other questions seperately and refer to the page number 15 of the updated HOMEWORKLIB RULES of April/May 2020 and ask the questions accordingly and STAY HOME STAY SAFE.

First expression q <= p will result True as stated 3 is less than 8.
Second expression not( p == q - 5) will result True as q - 5 will be -2 and it is not equal to 8.
Third expression q != p % 5 will result False as p%5 that is 8%5 is 3 and q is also 3 so they are equal but since != operator is used the expression becomes false.
Fourth expression found or p > 5 and q == p + 5 will result False as q == p + 5 will be false because q is 3 and p+5 is 13 , p>5 will be true because p is 8. Now p > 5 and q == p + 5 will result True and False = False and found is False so False or False will be False.   

For the verification here is a snapshot of the expression executed in Python Idle:

Here are the Truth tables used for solving the above expressions:-

X Y X AND Y
FALSE FALSE FALSE
FALSE TRUE FALSE
TRUE FALSE FALSE
TRUE TRUE TRUE
X Y X OR Y
FALSE FALSE FALSE
FALSE TRUE TRUE
TRUE FALSE TRUE
TRUE TRUE TRUE
X NOT X
FALSE TRUE
TRUE FALSE
Add a comment
Know the answer?
Add Answer to:
1. Evaluate the following expressions if p = 8, 9 = 3, and the value of...
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
  • please help to solve the following problem on python 3.0 please Translate the following problem descriptions...

    please help to solve the following problem on python 3.0 please Translate the following problem descriptions into Python. If score is greater than or equal to 90, then grade is set to ‘A’. a) Assume the variables p, v, and r have been assigned some values we want to test. If the expression t / (p – v) is greater than 10, then r is set to 0.   If the result is not greater than 10, r is set to...

  • 9. Prove that the following kogical expressions aro logically equivalent by applying the law of logic...

    9. Prove that the following kogical expressions aro logically equivalent by applying the law of logic 10. Give a logical expression with variables p, q, and r that's true only if p and q are false and r is true. 11. Predicates P and Q are defined below. The domain of discourse is the set of all positive integers. P(x): x is prime Qlx): x is a perfect square Are the following logical expressions propositions? If the answer is yes,...

  • In Python. Complete the following programs. Begin each program with a comment that includes: • Your...

    In Python. Complete the following programs. Begin each program with a comment that includes: • Your name • The project/program • Brief description of the problem Lab3Pro1 A supervisor in a manufacturing company wishes to display the bonus amount for an employee based on this year's production. Input Output Processing Distribute bonuses as follows: Display the results as follows: Prompt for user input "Enter number of Units produced" Store the amount entered Bonus This year's production bonus will be $nnnnn...

  • For this discussion, you will be working with regular expressions. Please create a regular expression that...

    For this discussion, you will be working with regular expressions. Please create a regular expression that requires passwords to begin with an uppercase letter, followed by five lowercase letters, followed by a one-digit number (0-9), and ending with one symbol (@, $, %, or &). You may use the index.htm file included with this discussion to test your regular expression. Note that the index.htm file contains HTML and JavaScript. To test your regular expression, simply assign your regular expression to...

  • Assume the following declarations have been made in main(): int howmany; Scanner kb = new Scanner(System.in);...

    Assume the following declarations have been made in main(): int howmany; Scanner kb = new Scanner(System.in); Random r = new Random(); Write code to do the following: Use a while loop to prompt the user for how many numbers are to be entered. If the user does not enter a positive number (a number greater than 0), display a message saying the number must be positive and to try again. Store this value in the howmany variable. Declare an integer...

  • 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...

  • Write a C++ program that uses: .selection constructs (if, if else, and switch) .multiway branches .looping...

    Write a C++ program that uses: .selection constructs (if, if else, and switch) .multiway branches .looping constructs (do and while loops) .Boolean expressions, bool and char types. 1. Develop a program that calculates charges for an Internet provider. The cost is determined by the amount of data used and the consumer plan. Package B (basic) is the most affordable if you plan on using < 20GB (20,000MB), however, if you consume more than 20GB (20,000MB) you are charged for each...

  • (Write or type in answers, except for problem #15, which should be entered as a small...

    (Write or type in answers, except for problem #15, which should be entered as a small program, tested, and submitted in Repl.it) 1. Write a Python statement to define a list named temps using the following elements, in order: 95, 100, 77, 54, 103, 82 2. a) What is the length of the list temps? b) What Python function can be used to obtain the length of the list? Use it in a statement to obtain the length of temps...

  • Need help with number 3, thanks! isplays l itnuml is less than num2. 2. (50+30- 80...

    Need help with number 3, thanks! isplays l itnuml is less than num2. 2. (50+30- 80 Points) Write a MATLAB function numcomp502 (numl, num2) that takes two numbers numl and as input and returns num3 as output, such that num3 is equal to 0, 1, and-1 depending on whether numl is equal to, greater than or less than num2 respectively. Test your code with the pairs (10, 5), (-3,-3), and (2, 10) as input. Attach a screen-shot. 3. 80 Points...

  • answer 8 using matlab Using nested loops, traverse through the matrix for the following. a) Replace...

    answer 8 using matlab Using nested loops, traverse through the matrix for the following. a) Replace all elements divisible by 3 with 100. b) Replace all elements divisible by 2 with 50. c) Replace the first element of each row with 10. d) Display the all elements of the 2D matrix as a 10 array (9 elements in 1 row) 8) Write a function file that determines the maximum element of an input matrix A using nested loops and counts...

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