When we read code and predict its output, it is called tracing code.

For this lesson, you will come up with your own challenging algorithm for other students to trace. It must contain at least 5 if statements and use at least one AND or OR boolean condition.

Note: Elif or else statements will not count - your statements must be if statements. Each if statement should use a unique variable name.

For this challenge, try reading 3 or 4 of your classmates' code as well. Trace their code and predict what it will output, then check the code by running it to see if you got it right, and submit your work for a grade.

Answer :

drasenick

Answer:

Answer:

PYTHON

a = 2

b = 0

c = 4

d = -1

e = 9

g = 77

if -1 < a < 2:

print(a % 2)

if not c and b:

print(c//a)

if 50 >= d or 2 <= d >= 8:

print(d*d)

if 0 == e and e < 100:

print(e**e)

if g and g > 77:

print(g)

fichoh

The program involves tracing the possible output of the code which contains a total of 5 variables. The program is written in python 3 ;

a , b, c, d, e = (10, 5 , 6, 2, 9)

#using tuple unpacking, assigns values to the variables a, b, c, d, e

if a > b:

#first if statement, tests if variable a is greater than b

e = b + 1

#if it is. Set variable e = b + 1

if b > c :

#if the above check is false, then check if b > c

e = b * 2

#if it is, set variable e = b×2

if c > d :

#if the above is false, check if c >d

e = c /2

#if it is, set, variable e to c divided by 2 ; if not

if (d>e) or (d > c):

#if either condition is true,

e = d -2

#set e to d - 2 ; if not

if e < a :

#Check if e > a

e = e * 5

# set e to e multiplied by 5

print(e)

#display the final value of e

Learn more on python programs :https://brainly.com/question/14786286

Other Questions