Please help with Conditionals & Control Flow Exercise 12


#1

Please, someone to give me an example to solve this exercise, thank you very much


#2

The blanks symbolize expressions that we have to create and replace them with. What's an expression, you ask? It is any form or statement that yields a value.

a + 2

is an expression. Given that a will have some numeric value, it would express the sum of that value and 2. If it is a string value, the 2 would be concatenated (appended) to the string. Still, it is just a value and not program code.

2 + 2

is an expression that always yields the same value. Not much use in code but it is an expression that is worth noting since we can see it as a constant.

In a condition, 2 + 2 will evaluate to the boolean, True. Try it for your first blank (be sure to remove all the underscores).

That is an example of a concept in programming called, truthiness. It's the way that the interpreter can examine a value and determine if it should be cast as True or False to carry out the conditional expression, which must always yield a boolean.

2 > 1

is also an expression, but it contains an assertion, as well. This is more closely related to boolean since it is either True or False, and in this case True. Try that expression in the blank on your second function.


#3

thank you very much.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.