Question: This Code is in Python Keywords: break and continue are not allowed. Global variables are not allowed. If you do not know what that means,

This Code is in Python

This Code is in Python Keywords: break and continue are not allowed.

Keywords: break and continue are not allowed. Global variables are not allowed. If you do not know what that means, for now, interpret this to mean that inside of your functions you can only use variables that are created in that function. For example, this is not allowed, since variable x is not a parameter of function a_times(a) nor is it a variable created in function a_times(a). It is a global variable created outside of all functions. def a_times(a): result=x*a return result x=float(input("Give me a number: ")) print(a_times(10))

1.2 Question 2: (5 points) Implement a Python function called two_length_run that takes a list of numbers as input parameter and returns True if the given list has at least one run (of length at least two), and False otherwise. Make sure the function is efficient (i.e it stops as soon as the answer is known). Then, in the main, your program should ask the user to input the list, then it should call two_length_run function, and print the result. You can obtain a list of numbers from the user as explained in Question 1 Four examples of program runs Please input a list of numbers separated by space: 1 True 4 3 3 4 3 3 4.5 65 Please input a list of numbers separated by space: 1 2 3 True Please input a list of numbers separated by space: 1.023.7 43 2 False Please input a list of numbers separated by space: 7.7 False Function call example: >>>twolength_run( [2.7, 1.0, 1.0, 0.5, 3.0, 1.0) True

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!