Name_______________________________ Your final answer to each question should appear on this sheet.
v22.0002, Sample questions for the final
None of the methods you write should read from the keyboard.

1a Given the following method heading
 def firstOccur(ch, s):
write a method that returns the first occurrence of the character stored in ch in the string s. If the character is found in the string, your method should return its position. Thus if s 'abcdefg' and the value of ch is d, your program would return 3. If the character is not found in the string, your program should return -1.

2. Write a method with the heading def primeness( number): that returns True if number is prime and False if it isn't.

3.. Complete the following method that adds the odd numbers from 1 to num
def add(num):
#adds odd numbers from 1 to num

     sum = __________________________
     for j in range( ___________________)
     
         if__________________________:
	 
		sum = _______________________
		print(j)

     return ________________________________





4. Complete the following method that places odd numbers found in the string s in consecutive elements of the list x.
def assign(s):
#places odd numbers in consecutive elements of list
     length = __________
     x = ________*[0]
     index = 0
     for j  in range(__________):
        digit = int(s[j]) #convert to int digit
        if ______________________ :# test for odd #
            x[____________] = digit
            __________
     print("The odd numbers are")
     for j  in range(index):
         print(x[j])



5. Write a method def eliminate(x, y) that copies all the elements of the list x except the largest value into the list y.