Learning path · Programming Foundations with Python
← Back to lesson · FunctionsImplement g(n)
A1300Function
English
Language
Contribute a translation- Time limit
- 2000 ms
- Memory limit
- 256 MB
- Submissions
- 24
- Correct
- 4
- Solved by
- 4
- AC rate
- 16.667%
Statement
Implement g(n) returning $1 + 2 + \cdots + n$. Do not read input or print anything: the grader calls your function and prints what it returns. (Python only.)
Input
One integer $n$ ($1 \le n \le 10^6$), read by the grader.
Output
The grader prints the value your function returns.
Examples
Sample input 1
10
Sample output 1
55
Notes
Signature: def g(n):
Tags
No tags yet
This problem accepts only these languages.
Python 3, PyPy3