Question

Create a function which returns the number of odd integers in a list (python)

Answer #1

Thanks for the question. Below is the code you will be needing. Let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please leave a +ve feedback : ) Let me know for any help with any other questions. Thank You! =========================================================================== def odds_in_list(lst): odds = 0 if lst == None: return 0 for num in lst: if num % 2 == 1 or num % 2 == -1: odds += 1 return odds print(odds_in_list([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]))

==================================================================

Write a Python function that takes a list of integers as a
parameter and returns the sum of the elements in the list. Thank
you.

Write a Python function that takes a list of integers as a
parameter and returns the sum of the elements in the list. Thank
you.

Write a Python function that takes a list of integers as a
parameter and returns the sum of the elements in the list. Thank
you.

Python pls
create a function called search_position. This function
returns a list of 2 tuples and the number should be start highest
number. The first index is the number, and second are list of 2
tuples that sorted by position in alphabetical order: The first
index will be position and second index will be champion's
name(This also should be sorted by alphabetical
order).
team1 = {'Fiora': {'Top': 1, 'Mid': 4, 'Bottom':
3},'Olaf': {'Top': 3, 'Mid': 2, 'Support': 4},'Yasuo': {'Mid': 2,...

Create a function that returns a boolean value if all-elements
are not odd or even.
Using Dr. Racket and the How to Design a Function (HtDF )
recipe, create a function that will return the following
check-expect:
(check-expect (all-elements? even? (list 1 2 3) false)
(check-expect (all-elements? even? (list 2 4 6) true)
(check-expect (all-elements? odd? (list 1 3 5) true)
Can you find an element in the list where the predicate fails
(return false)?

Python Question:
Write a function which returns the sum of squares of the
integers 1 to n. For example, the sum of the squares from 1 to 4 is
1 + 4 + 9 + 16, or 30. You may choose what should be returned if n
== 0
You may not use the built-in Python sum function.
The Solution Must be recursive
>>> sum_of_squares(1)
1
>>> sum_of_squares(4)
30
>>> sum_of_squares(8) # 64 + 49 + 36 + ... +...

Write a PYTHON function called myMax which accepts a LIST of
numbers and returns the maximum number in the list. Do NOT use
Python’s built-in function max.
Example: result = myMax([-999000, -1000000, -2000000]);
print(result) #output is -999000
Example: result = myMax([1000000, 1000001, 1000002]);
print(result) #output is 1000002

Implement function reverse that takes a 2D list
(a list of list of integers) and returns a new 2D list where the
items in each row are in reverse order. You maynot use slicing. You
may not modify the input list. The returned list should be
completely new in memory – no aliases with the input 2D list. From
list methods, you may use only the .append().
Examples:
reverse([[1,2,3],[4,5,6]])
-> [[3,2,1],[6,5,4]]
reverse([[1,2],[3,4],[5,6]]) ->
[[2,1],[4,3][6,5]]
True
False
In python please

In Python language:
Create a function that takes as input two numbers, m and n,
m<n, and returns an m×n list-of-list-of-numbers. Each element of
the outer list will be a list of consecutive integers, beginning
with 1 and ending with n−1. If you're feeling bold, try to use list
comprehension.

Implement in python a function avg_val(lst), which returns the
average
value of the elements in list.
For example, given a list lst: [19, 2, 20, 1, 0, 18], the
function
should return 10.
The name of the method should be avg_val and the method should take
one parameter which is the list of values to test. Here is an
example call to the function
print(avg_val([19, 2, 20, 1, 0, 18]))

ADVERTISEMENT

Get Answers For Free

Most questions answered within 1 hours.

ADVERTISEMENT

asked 54 seconds ago

asked 14 minutes ago

asked 18 minutes ago

asked 23 minutes ago

asked 30 minutes ago

asked 35 minutes ago

asked 50 minutes ago

asked 53 minutes ago

asked 59 minutes ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago