Example output
Here's the equivalent Python code for the provided C++ code, while emphasizing the use of `input()` and `print()` functions:
```python
def sum(a, b):
c = a + b
return c
def main():
a = int(input("Enter two numbers: "))
b = int(input())
result = sum(a, b)
print("Sum is:", result)
if __name__ == "__main__":
main()
```
In this Python code:
1. The `input()` function is used to get user input. We explicitly convert the input values to integers using `int()` since `input()` returns a string.
2. Instead of `cout`, we use the `print()` function to display output.
3. The function definitions are preserved, and we call the `main()` function at the end, just like in C++.
4. The `if __name__ == "__main__":` block ensures that the `main()` function is only called when the script is run directly and not when it's imported as a module.
This Python code closely follows the structure and functionality of the original C++ code while adapting to Python's syntax and input/output functions.