Question

   PYTHON --create a function that accepts a list of numbers and an int that returns...

  
PYTHON

--create a function that accepts a list of numbers and an int that returns index of 2nd occurrence of the int in list, otherwise returns None if # does not repeat more 2 or more times
EX: [10,24,3,45,10,49,4,5], 10) returns 4

--create a function that accepts a string that returns true if every letter of the alphabet can be found at least one time in the string, (has to be the lowercase alphabet), and false otherwise.
  

for BOTH you can ONLY use these functions --- append, len, str, float, range, strip, split, int


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

1.

Source Code:

def firstRepeat(lst,num):
   count=0
   for i in range(0,len(lst)):
       if(lst[i]==num):
           count=count+1
       if(lst[i]==num and count==2):
          return i

print(firstRepeat([10,24,3,45,10,49,4,5],10))

main.py 1. def firstRepeat(lst, num): 2 count=0 3 for i in range(0, len(lst)): 4- if(lst[i]==num): 5 count=count+1 6 if(lst[i

2.

Source Code:

def isAll(string):
   isChar=False
   alpha=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
   for i in range(0,26):
       isChar=False
       for j in range(0,len(string)):
           if(alpha[i]==string[j]):
               isChar=True
       if(isChar==False):
           return False
   return True

print(isAll("abcdefghijklmnopqrstuvwxy")) # returns false because there is no 'z'
print(isAll("abcdefghijklmnopqrstuvwxyz")) # returns true

,x,y,z] main.py 1def isall(string): 2 isChar=False 3 alpha=[a,b,c,d, e 4 for i in range(0,26): 5 ischar=Fals

Add a comment
Know the answer?
Add Answer to:
   PYTHON --create a function that accepts a list of numbers and an int that returns...
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