Ver Mensaje Individual
  #19 (permalink)  
Antiguo 15/02/2012, 18:49
BiChOmAlO_TGN
 
Fecha de Ingreso: julio-2003
Mensajes: 243
Antigüedad: 20 años, 9 meses
Puntos: 11
Respuesta: Ejercicios python con solucion

Cita:
Iniciado por razpeitia Ver Mensaje
Los puntos son por problemas hechos (no exactamente como funcione).

El máximo puntaje hasta ahora es 209, lo logras haciendo todos los ejercicios y todos los retos.
Ok ya entiendo, bueno por el momento solo me preocupare de ir haciendo y aprendiendo..

estoy atascado de nuevo..

Cita:
Create a function addNumbers(x) that takes a number as an argument and adds all the integers between 1 and the number (inclusive) and returns the total number.

Examples

>>> addNumbers(10)
55
>>> addNumbers(1)
1


Y empieza asi el ejercicio :

def addNumbers(num):
total = 0
i = 1
while
Conozco el ciclo indefinido while, pero no logro tener una idea para aplicarlo, he echo el ejercicio usando for sin problema, pero tiene que ser con while

Código Python:
Ver original
  1. def addNumbers(num):
  2.     total=0
  3.     for num in range(num+1):
  4.         total=total+num
  5.         return total


como seria haciendolo con while?


Gracias de nuevo