Full name

Report a typo

Rewrite the code below using the with keyword.

Make sure to use the same variable names for file objects!

Write a program in Python 3
f1 = open('name.txt')
f2 = open('surname.txt')
f3 = open('full_name.txt', 'w')

name = f1.read()
surname = f2.read()

full_name = name + ' ' + surname

f3.write(full_name)
___

Create a free account to access the full topic