python SimpleAdding
2014-04-22 16:42
309 查看
Using the Python language, have the function SimpleAdding(num) add
up all the numbers from 1 to num.
For the test cases, the parameter num will
be any number from 1 to 1000.
Input =
12Output = 78
up all the numbers from 1 to num.
For the test cases, the parameter num will
be any number from 1 to 1000.
def SimpleAdding(num): # code goes here if num > 1: return num + SimpleAdding(num-1) else: return 1 # keep this function call here # to see how to enter arguments in Python scroll down print SimpleAdding(raw_input())
Input =
12Output = 78
相关文章推荐
- A simple unix/linux daemon in Python
- python的SimpleHTTPServer
- Making a simple web server in Python.
- python decorator simple example
- Really Simple HTTP Server with Python
- python webserver, based on SimpleHTTPServer
- python整理二十四——让simplejson支持datetime类型的序列化
- python实现简单的redis 队列 SIMPLE PYTHON QUEUE WITH REDIS
- Matrix Factorization: A Simple Tutorial and Implementation in Python
- 使用python SimpleHTTPServer 快速搭建Web服务器
- python_simplejson 记录
- python JSON性能测试与simplejson对比
- 在python中使用SimpleITKeras 进行 mha医学图像加载显示
- 详解Python使用simplejson模块解析JSON的方法
- 在安装python的pip工具时,遇到以下报错[Errno -3] Temporary failure in name resolution',)': /simple/pip/
- Simple Web Crawler Used Python
- Simple Python Queue with Redis
- A simple to "path" ElasticNet parameters ( in python)
- SimpleClass:Python之面向对象编程
- Matrix Factorization: A Simple Tutorial and Implementation in Python