Start a new topic

Stuck on code in Ceed Universe

I just don't understand how to do this, any help? import math """Finish the function pi_approx which accepts a float n as an input.The function should sum n reciprocal-squares i.e 1/(1**2) + 1/(2**2) + ... + 1/(n**2). Then your function should multiply this result by six and square root it. math.sqrt(x) returns the square root of x """ Thanks

To complete this function, you'll have to make sure your function accepts a float. 

Use typecasting for the variables. You can use for example:

float(a)

int(number)


example:

for a in range(1, int(number)+1):


I hope this will help.

Thanks! Managed to work it out :)

On one of the unlock door things in "CEED-Universe" it says 

if a_bool:


# if what follows an 'if' evaluates to True, the indented code below will run

    key.move ('up')

but when I type in 


if a_bool == True


it gives me a syntax error pointing at the e in true,


Please tell me what I am doing wrong.

Did you put a colon after True? Like if a_bool == True:
Did you put a colon (:) after True?
No I didn't thank you so much for your help

Hey i am also stuck on this code, i used your suggestion but it still doesnt let me pass, could i see what you did?

Yeah, same here
Sadly I did not get through either
Which code are you stuck on? (copy and paste it please)

"""Finish the function pi_approx which accepts a float n as an input.The function should sum n reciprocal-squares i.e 1/(1**2) + 1/(2**2) + ... + 1/(n**2). Then your function should multiply this result by six and square root it. math.sqrt(x) returns the square root of x """ Thanks

Adam- I am stuck on the same code that you posted in the thread, the pi_approx function. What was your solution? Thanks.

Login or Signup to post a comment