216k views
5 votes
Y = 4 * X + 14 You have been given an incomplete Python program in the answer box below . Please complete the program by filling in the lines as required . The program takes as input an integer X , and computes the following formula . Z = Y + 4 If the value of Y is greater than 50 , the program should do the following : latform Z = Y * 2 If the value of Y is less than or equal to 50 , the program should do the following : Finally , the value of Z should be printed with print ( ) command . Answer : ( penalty regime : 0 % ) Reset answer UOM 123 X = int ( input ( ' Enter x : ' ) ) Y = X * 4 + 14

User Stimsoni
by
7.7k points

1 Answer

2 votes

Final answer:

A Python program to calculate and print the value of Z based on the equation Y = 4 * X + 14 is provided. The program applies conditional logic to alter the value of Z depending on whether Y is greater than 50 or not, and outputs the final result.

Step-by-step explanation:

The question involves a simple Python programming task, where the goal is to calculate the value of Z based on the given linear equation Y = 4 * X + 14, and then perform additional operations based on the value of Y.

Here is the completed Python program:

X = int(input('Enter x: '))
Y = 4 * X + 14
if Y > 50:
Z = Y * 2
else:
Z = Y + 4
print(Z)

This program first prompts the user to enter an integer value for X. Then it calculates the value of Y using the provided linear equation. After that, it checks if Y is greater than 50. If it is, then Z is set to twice the value of Y, otherwise, Z is calculated by adding 4 to Y. Finally, the value of Z is printed out.

User Jorge Candeias
by
7.6k points