Finding The Python Solutions Question And Answers Hi, there are 6 easy python programing question, please follow the instruction, Thank you Q2 1 Point Writ

Finding The Python Solutions Question And Answers Hi, there are 6 easy python programing question, please follow the instruction, Thank you Q2
1 Point
Write a function named avg that fulfills the following specification by replacing the pass line:
def avg (numbers) :
NH
signature: list (float) -> float
precondition: numbers != []
returns the average (mean) of a non-empty list of floats
pass # TODO: implement the body of this function
You may assume that the input is not an empty list. That is, your code does not need to handle
the situation when numbers is []. Your function should not use print or input at all.
Note: for the purposes of this problem, you may not use the built-in sum function, rather
you should write a loop that iterates over the items in the list.
Please select file(s)
Select file(s)
Q3
1 Point
Write a function named sum_some ( num1, num2, 1st) with three parameters: lower, upper and
numbers, that returns the sum of the elements of the list numbers which are between lower and
upper (inclusive). If the list numbers is empty then your function should return O. Your
function should take 2 integers and a list and returns an integer.
For example:
>>> sum_some (0, 100, [])
0
>>> sum_some (0, 100,[1,2,3,4,5])
15
>>> sum_some (2 4 [1,2,3,4,5))
9
>>> sum_some (3, 3 , [2,2,3,3,4,4])
6
Your function should not use print or input at all.
Please select file(s)
Select file(s)
Q4
1 Point
Write a function my_count(1st, val) that takes a list of integers, Ist, and an integer, val, and
returns the
number of times that val occurs in Ist. If val does not appear in Ist, the function should return O.
Don’t make a call to the list method count() in your function. Instead, you should think about
how the count method might be implemented and how to recreate that functionality.
The function signature is given below:
def my_count(lst,val):
# sig : list (int), int -> int
For example, a call to my_count([7,2,1,3,7,9), 7) would return 2 and a call to
my_count([4,6,1,2], 3) would return 0.
Please select file(s)
Select file(s)
Q5
2 Points
Write a function named is_sorted(1st) that takes a list of numbers and returns True in case
the list is in increasing order, and False otherwise.
This means that every number in the list should be larger or the same as the preceding number.
By convention, we will return True for the empty list.
For example:
>>> is_sorted (1)
True
>>> is_sorted ([1])
True
>>> is_sorted ([1, 2
True
>>> is_sorted ([1, 2,2
True
>>> is_sorted ([1 2 2
False
3])
3])
1
11)
Hint: notice that a list is sorted just in case there is no adjacent pair of entries that is out of
order. In other words, a list is sorted if for every adjacent pair of entries, the one on the left is
less than or equal to the one on the right.
Note: for the purposes of this problem, you may not use any of Python’s built-in sorting
functions, instead, you should traverse the list and check that all adjacent pairs of entries are
ordered.
Your function should not use print or input at all.
Please select file(s)
Select file(s)
Q6
2 Points
Write a function get_common_elems (Isti, Ist2) that takes two lists of integers, Ist1, and Ist2,
and returns a new list containing the elements in common between the two lists. You can
assume that there are no
repeated elements in the lists. Also, the ordering of the elements in the returned new list is not
significant
The function signature is given below:
def get_common_elems(1sti, 1st2):
sig : list (int),list (int) -> list(int)
For example, a call to get_common_elems (15,1,4,3,6],[6,1,8,3]) will return the list 1, 3, 6.
Hint: Think about how you can make use of the in operator. You only need to iterate over one of
the lists.
Please select file(s)
Select file(s)
Submit Answer

Purchase answer to see full
attachment

Don't use plagiarized sources. Get Your Custom Essay on
Finding The Python Solutions Question And Answers Hi, there are 6 easy python programing question, please follow the instruction, Thank you Q2 1 Point Writ
Just from $13/Page
Order Essay
Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.