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

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.1 Question 1: (5 points) Implement a Python function called count_pos that takes a list of numbers as an input parameter and returns the num ber of elements of that list that are positive (i.e. > 0). Then, in the main, your program should ask the user to input the list, then it should call count pos function with that list, and print the result. In this question you may assume that the user will follow and split to handle the user input. Here is a way to ask a user for a list: raw_input input ( "Please input a list of numbers separated by space:.strip().split) But now raw_input is a list of strings that look like numbers so you need to create a new list that is a list of equivalent numbers your instructions and enter a sequence of numbers separated by spaces. You can use str method .strip Three examples of program runs: Please input a list of numbers separated by space: 2 3.5 -1-100 There are 2 positive numbers in your list Please input a list of numbers separated by space: 1 0 22 0 1 There are 3 positive numbers in your list Please input a list of numbers separated by space There are 0 positive numbers in your list Function call example: >>>count pos(11, 0, 22.2, 0, 1.0,-10.5])
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
