[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 =

[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

[Tutor] Summing arrays

2017-03-16 Thread Aaliyah Ebrahim
Hi guys! I hope you can assist me with understanding and fixing my error below. Thanks for this amazing forum :) def sum2(N): b = np.arange(1,N+1,1) mylist = [ ] for i in b: terms = 2*(1+3**(i-1)) a = mylist.append[terms] return np.sum(mylist)

[Tutor] Exponential function

2017-02-14 Thread Aaliyah Ebrahim
Hi For the function 1*10^x, is there a specific way of computing *10^x or will it just be the following : 1*10**x Thank you. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: