+ 20

[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

13th Nov 2017, 5:39 PM
SAKSHI
SAKSHI - avatar
10 Réponses
15th Nov 2017, 1:43 PM
LukArToDo
LukArToDo - avatar
15th Nov 2017, 5:08 PM
David Akhihiero
David Akhihiero - avatar
+ 4
@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
14th Nov 2017, 8:40 AM
SAKSHI
SAKSHI - avatar
+ 4
@Y_@_$_hT. i apolozise for my mistake u did good
14th Nov 2017, 9:01 AM
SAKSHI
SAKSHI - avatar
+ 3
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')
15th Nov 2017, 2:01 AM
SergK
SergK - avatar
15th Nov 2017, 8:27 PM
Coder++
Coder++ - avatar
+ 2
I try to make my Codes as simple as I can without advanced stuff like objects: https://code.sololearn.com/cQuSe28L2kUD/?ref=app
14th Nov 2017, 1:58 PM
Lucas Pardo
Lucas Pardo - avatar
+ 1
https://code.sololearn.com/c2kanm8SIJh6/?ref=app
15th Nov 2017, 10:42 AM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
15th Nov 2017, 11:57 AM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
+ 1
it was pretty difficult for me, but i seem i did this https://code.sololearn.com/c5c1K9lgSGsx/?ref=app
17th Nov 2017, 5:13 PM
Zelski
Zelski - avatar