What is the problem with the following if instruction count = 15.0 if (count / 3.0) == 5.0 : print(“ah shucks”) else count < 5.0 : print("oh no...")
Blog
What is the first line of code that python will execute in f…
What is the first line of code that python will execute in following script?Select the line number 1 def add_five( num: int ) -> int:2 result = num 3 return result + 5 4 def main() -> None:5 print(add_five(5)) 6 main()
Consider a function named calc, which accepts two numbers as…
Consider a function named calc, which accepts two numbers as ints and returns their sum as an int. Which of the following is the correct statement to invoke the function calc?
Identify the error in the following short program and point…
Identify the error in the following short program and point it out: def y() -> int : return 0 def mystery(x : int) -> int: s = 0 y = x i = 0 while i < x: x = i + 1 s = s + x x = x + 1 return s
Which of the following is the correct header for a greater_t…
Which of the following is the correct header for a greater_than function definition that takes two arguments of type float and returns true if the first value is greater than the second value?
What is the output? x = 0 match x : case _ : m…
What is the output? x = 0 match x : case _ : msg = “anything” case 0 : msg = “zero” print(msg)
Assuming that the user provides 3 as input, what is the outp…
Assuming that the user provides 3 as input, what is the output of the following code snippet? x = 0 y = int( input(“enter a y!”) ) if y > 0 : x = 2 * y else : x = 2 + x print( “x: ” + str(y) )
Which code snippet tests if a temperature is between 32 and…
Which code snippet tests if a temperature is between 32 and 100? (non inclusive) Select ALL that would do the trick.
What is the output of this loop? i = 0foundwhile i < 20 and...
What is the output of this loop? i = 0foundwhile i < 20 and not found: sum = (i * 2) + (i * 3) print( str(sum) + " " ) if sum > 50: found = True i = i + 1
What is the error in the following function definition? def…
What is the error in the following function definition? def tripler(numParam: int) -> int: result = numParam * 3;