Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. (TCOS 4 and 6) Suggest an instruction for the two missing lines so that the f

ID: 3672056 • Letter: 1

Question

1. (TCOS 4 and 6) Suggest an instruction for the two missing lines so that the following code accepts two integers from the user x and y and then displays a message about whether their sum is greater than the value ten.
# This function accepts two integer inputs from the user x and y.
# The program then computes their sum and displays text indicating whether the sum is greater than 10.
x = input(‘Enter x value:’)
y = input(‘Enter y value:’)
z = x + y
____________________________
     print(“The sum is less than 10”)
____________________________
     print(“The sum is greater than 10”)
else
     print(“The sum is equal to 10”) (Points : 15)

      
      

Question 2.

      
      

Question 3.

      
      



1. (TCOS 4 and 6) Suggest an instruction for the two missing lines so that the following code accepts two integers from the user x and y and then displays a message about whether their sum is greater than the value ten.
# This function accepts two integer inputs from the user x and y.
# The program then computes their sum and displays text indicating whether the sum is greater than 10.
x = input(‘Enter x value:’)
y = input(‘Enter y value:’)
z = x + y
____________________________
     print(“The sum is less than 10”)
____________________________
     print(“The sum is greater than 10”)
else
     print(“The sum is equal to 10”) (Points : 15)

      
      

Question 2.

2. (TCO 6) Suggest an instruction for the missing line so that the function VolumeRectangularPrism accepts the input variables length, width, and height
and computes the volume of a rectangular prism in a variable volume
depending on the inputs given. The volume is printed to display.
# This function receives previously defined float variables length, width, and height
# and computes the volume of a rectangular prism and outputs to display.

____________________________
volume = length * width * height
print volume (Points : 15)

      
      

Question 3.

3. (TCOs 4–6) Write a Python program to prompt the user to enter two decimal integer numbers x
and y and then read lcd.buttonPressed to determine which Boolean output to display per the following.
lcd.UP will compute the result of x AND y.
lcd.LEFT will compute the result of x OR y.
lcd.RIGHT will compute the result of x XOR y.
lcd.DOWN will exit.
The function lcd.message is then called to indicate which operation was selected and its result. For example, if UP was selected, the LCD output would show “X AND Y =” and the result.
Be sure to fully and properly document your program with comments. (Points : 70)

      
      

Explanation / Answer

1)

          1. if z < 10:

          2. elif z > 10:    

2)

          def VolumeRectangularPrism(length,breadth,width):

3)

        x=input("enter the x value")

        y=input("enter the y value")

           while if lcd.select==lcd.down:

                       if lcd.select == lcd.up:

                                     x=x and y

                       end;

                     if lcd.select ==lcd.left :

                                         x= x or y

                      else

                                   x= ((not x) and y )or( y and (not x))

                        end

             end