[challenge] let's code for reasoning question1.... | Sololearn: Learn to code for FREE!


[challenge] let's code for reasoning question1....

u have to take some numbers from the user and then has to evaluate as per the below two condition logic 1: the given input contains same difference between adjacent numbers example goes like this : if input 1,3,5 output should be logic is constant difference and next number is 7 logic 2: the given input contains some constant increment in difference between adjacent numbers.example: if input is -5, -4, -2 continued in the code https://code.sololearn.com/ciKMduC4jSzk/?ref=app

11/13/2017 5:39:07 PM


15 Answers

New Answer


My try : https://code.sololearn.com/cNhiwnlK60G8/?ref=app


My try https://code.sololearn.com/c6Yo2c37gQlX/?ref=app


@godie did it correctly others can have it as reference.... but the input must be like 1 3 5 7 9 11 but not as... 1 3 5 7 9 11


@[email protected]_$_hT. i apolozise for my mistake u did good


NO LOGIC HERE, NO IF statement think about that sequence like speed with acceleration and distance if acceleration is 0, we have logic 1, otherwise logic 2 https://code.sololearn.com/c1oePiXRZb3Z n1,n2,n3 - first three numbers (you don't need more) count - amount to generate def p (n1,n2,n3,count=1): v0 = n2-n1 ; ac = n3 + n1 -2*n2 ; x = n3 print('\nFor (', n1,n2,n3, ') your next number(s) is(are) ' ) for t in range(2,count+2): x += v0 + ac*t print(x) print('End')


my answer https://code.sololearn.com/c1yAHu5vLxZj/?ref=app


I try to make my Codes as simple as I can without advanced stuff like objects: https://code.sololearn.com/cQuSe28L2kUD/?ref=app




New version. https://code.sololearn.com/cPWZpnwFX6OU/?ref=app


it was pretty difficult for me, but i seem i did this https://code.sololearn.com/c5c1K9lgSGsx/?ref=app