In: Computer Science
Just need the desktop test for this two function a) Write a function that receives the number of terms (n) and returns a container with the first n TunaPoke numbers. Present a "print screen" of the results and their respective desktop test when the function is invoked with the 16. (b) Write a function that receives a limit number and returns a container with the first numbers TunaPoke that do not exceed the specified limit. Present a "print screen" of the results and their respective desktop test when function is invoked with 1000.
def tunapoke(n): if n==1: return [1] if n==2: return [1,2] if n==3: return [1,2,3] ls=[1,2,3] for i in range(3,n): if ls[i-1]%2==0 and ls[i-1]%3!=0: num=ls[i-1]+ls[i-2] ls.append(num) elif ls[i-1]%3==0 and ls[i-1]%2!=0: num=ls[i-1]+ls[i-2]+ls[i-3] ls.append(num) else: num=ls[i-1]+1 ls.append(num) return ls def tunapoke_for_nth_no(n): if n==1: return [1] if n==2: return [1,2] if n==3: return [1,2,3] ls=[1,2,3] j=0 i=3 while ls[i-1]<=n+1: if ls[i-1]%2==0 and ls[i-1]%3!=0: num=ls[i-1]+ls[i-2] ls.append(num) elif ls[i-1]%3==0 and ls[i-1]%2!=0: num=ls[i-1]+ls[i-2]+ls[i-3] ls.append(num) else: num=ls[i-1]+1 ls.append(num) j+=1 i+=1 del ls[-1] return ls