Question

In PYTHON: Write a function that receives a list of integers and returns the number of...

In PYTHON:

Write a function that receives a list of integers and returns the number of integers that are larger than the element immediately before them. For example, given [1,2,3,-5,0,-5,-10] the function should return 3 (since 1<2, 2<3, and -5<0).

0 0
Add a comment Improve this question Transcribed image text
Answer #1

def fun(a):

count=0
for i in range(len(a)-1):
if(a[i]<a[i+1]):
count=count+1;
  
return count
lt =[]
n = int(input("Enter the no. of element in list: "))
print("Enter the element")
for i in range(0,n):
numbers = int(input())
lt.append(numbers)
print("Element of list is:",lt)
  

print(fun(lt))

Add a comment
Know the answer?
Add Answer to:
In PYTHON: Write a function that receives a list of integers and returns the number of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT