+ 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
10 odpowiedzi
+ 12
+ 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
+ 4
@Y_@_$_hT. i apolozise for my mistake
u did good
+ 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')
+ 3
+ 2
I try to make my Codes as simple as I can without advanced stuff like objects:
https://code.sololearn.com/cQuSe28L2kUD/?ref=app
+ 1
https://code.sololearn.com/c2kanm8SIJh6/?ref=app
+ 1
New version.
https://code.sololearn.com/cPWZpnwFX6OU/?ref=app
+ 1
it was pretty difficult for me, but i seem i did this
https://code.sololearn.com/c5c1K9lgSGsx/?ref=app