Question

Write a function findEvens that takes an integer, n, as input and returns the list of...

Write a function findEvens that takes an integer, n, as input and returns the list of even integers between 1 and n. Ex. Input: 10 Output: [2,4,6,8,10]

Write a function sortList that takes in a list of strings and returns a list of those strings now sorted and lowercase. Ex. Input: [‘ABE’,’CAD’,’gaB’] Output: [‘abe’,’acd’,’abg’]

Both done in Python

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

\color{blue}\underline{1:}

def findEvens(n):
    lst = []
    for i in range(1, n+1):
        if i % 2 == 0:
            lst.append(i)
    return lst


print(findEvens(10))

\color{blue}\underline{2:}

def sortList(lst):
    for i in range(len(lst)):
        lst[i] = ''.join(sorted(lst[i].lower()))
    return lst


print(sortList(['ABE', 'CAD', 'gaB']))
Add a comment
Know the answer?
Add Answer to:
Write a function findEvens that takes an integer, n, as input and returns the list 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