Output: Standard Output (stdout)
Memory limit: 100 megabytes
Time limit: 1.0 seconds
I/O and Documentation
- Use the
input()function to get input.
- Use the
print()function to write output.
- You are permitted to view the Official Python Documentation during an NZIC contest.
- We use Python 3.8.
Write a program to add two numbers and print the result. Numbers will be space separated on a single line (see the sample input and output below). You may copy-paste the below example if you understand it.
nums = input().split() total = int(nums) + int(nums) print(total)
Or, for those who are more experienced, a one-line solution is:
- Go to the submit tab and upload the addition program above by copy-pasting and selecting Python in the language dropdown.
Do not use input prompts e.g.
input("Numbers: ")because the string
"Numbers: "will be evaluated as incorrect output. See the walk-through below to understand why.
- Walk-through example and explanation.
- Understanding submission feedback.
Note: There are two submission options for Python programs. You may select
Python 3.8 or
Python 3.6 (PyPy 7.3). PyPy is a just-in-time compiler which is often faster than the standard C Python interpreter. The compromise is the older version of Python. Newer NZIC problems should be solvable with C Python (unless specified) but other problems on this site might not be. If your Python solution is timing out it might be worth trying PyPy.
3 + 4 = 7
Sample Input 1
Sample Output 1