Re: [Tutor] While condition

2017-03-17 Thread Alan Gauld via Tutor
On 17/03/17 14:46, Aaliyah Ebrahim wrote: > Hi, in my code below, why is it returning a value that is greater than 1200 > if my condition is that the value should be less than 1200? Your condition is that it be less than 1200 when it enters the loop body. That means it will *always* be 1200 or

[Tutor] While condition

2017-03-17 Thread Aaliyah Ebrahim
Hi, in my code below, why is it returning a value that is greater than 1200 if my condition is that the value should be less than 1200? Thank you. def sum_list(val): list_sum = 0 n =0 mylist = [] while list_sum < val: n = n+1 term = n**2 list_sum =

Re: [Tutor] Maximum value in an array

2017-03-17 Thread Peter Otten
Aaliyah Ebrahim wrote: > Hi Hello again. Was your previous question answered to your satisfaction? > I am trying to practice the following question for my test tomorrow. > Please help me find my errors. > *Consider the following displacement sequence [x1; x2;. x11] and > velocity

[Tutor] Maximum value in an array

2017-03-17 Thread Aaliyah Ebrahim
Hi I am trying to practice the following question for my test tomorrow. Please help me find my errors. *Consider the following displacement sequence [x1; x2;. x11] and velocity sequence [v1; v2;... v11]:x[k+1] = x[k]+ 0.1 v[k]v[k+1] = v[k] - 10* x[k] + 0.1 sin(0.1* k