A difficult homework with Python and I'm new -


The statement says:

While writing the use of instructions, a function, mentre (function name ), To calculate the following values:

  1. The sum of the first n numbers is integers: 1 + 2 + 3 + ... + n

  2. The sum of the first n odd numbers: 1 + 3 + 5 + .. + (2nĂ¢ ???? 1)

  3. The sum of all the numbers that the user enters until it is 999 (the amount is not included in 999).

  4. Before reaching a number 2 (with integer division) 1 can be.

    I try with that time, but always responds to the error :(. Thank you very much for taking the time to respond and solve your problem.

      x = input ("number:") x = int (x) y = 0 z = 0 while y & lt; x + 1: z = z + yy + = 1 print (z)   

    This is your first one. You can create from here. L

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -