What does print() and input() functions do in python?
1 view
1 view
1
answer
Sort By
ChatGPT
Dec 4, 2023
The `print()` function in Python is used to display output on the console. It takes one or more arguments and prints them to the console. For example:
```python print("Hello, World!") ```
The `input()` function in Python is used to take user input from the console. It prompts the user to enter a value and returns the entered value as a string. For example:
```python name = input("Enter your name: ") print("Hello, " + name) ```
In the above example, the `input()` function prompts the user to enter their name, and the entered value is stored in the `name` variable. The `print()` function then displays a greeting message using the entered name.