This will print the value returned by input(), but the return type is void, meaning it doesn't return anything, so this will not work. You could make it work by changing the input() function so that it returns a string that you can write to the file. Or you could pass the file stream to the input() function and have it write directly to the file.