logo CodeStepByStep logo

print_entire_file

Language/Type: Python file input

Write a function named print_entire_file that prompts the user for a file name and prints the contents of that file to the console as output. You may assume that the file exists. For example, if the file example.txt contains the following input data:

hello  how    are you
1 2 3 4

I am fine

Then the following would be an example dialogue of your function:

Type a file name: example.txt
hello  how    are you
1 2 3 4

I am fine
Function: Write a Python function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.