Python Input and Output
Python Input and Output - Important Points
1. | Which function is used to take input from the user in Python? |
---|
A. input()
B. print()
C. read()
D. scanf()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The input() function is used to take input from the user in Python.
2. | Which function is used to display output in Python? |
---|
A. input()
B. display()
C. print()
D. D. show()
View Answer Discuss Work SpaceAnswer: option c
Explanation:
3. | How do you open a file for writing in Python? |
---|
A. file = open("filename.txt", "w")
B. file = open("filename.txt", "r")
C. file = open("filename.txt", "a")
D. D. file = open("filename.txt", "x")
View Answer Discuss Work SpaceAnswer: option a
Explanation:
4. | How do you open a file for reading in Python? |
---|
A. file = open("filename.txt", "r")
B. file = open("filename.txt", "w")
C. file = open("filename.txt", "a")
D. D. file = open("filename.txt", "x")
View Answer Discuss Work SpaceAnswer: option a
Explanation:
5. | How do you open a file for appending in Python? |
---|
A. file = open("filename.txt", "a")
B. file = open("filename.txt", "w")
C. file = open("filename.txt", "r")
D. D. file = open("filename.txt", "x")
View Answer Discuss Work SpaceAnswer: option a
Explanation: