Answer:
Joyner
David
USA
1.8
30
Explanation:
def saveUserProfile(firstName, lastName, age, height, country):
This is the definition of function named saveUserProfile which accepts the following parameters:
- firstName
- lastName
- age
- height
- country
filename = lastName + firstName + ".txt"
When the file is created it will be named as the lastName and firstName string combined with .txt as extension. For example if the lastName contains the name string Joyner and firstName contains the name David then the file created to be written is named as JoynerDavid.txt
outputFile = open(filename, "w")
This statement uses open() method in write mode and uses outputFile object to access the file. "w" represents write mode i.e. file is opened in write mode to write on it.
a) Joyner is written on line 1 of that file because of the following statement of above function:
print(lastName, file = outputFile)
This statement prints the string stored in lastName i.e. Joyner. Here outputFile opens the file in "w" write mode and writes the last name to the first line of the file.
b) David is written on line 2 of that file because of the following statement of above function:
print(firstName, file = outputFile)
This statement prints the string stored in firstName i.e. David. Here outputFile opens the file in "w" write mode and writes the first name to the second line of the file.
c) USA is written on line 3 of that file because of the following statement of above function:
print(country, file = outputFile)
This statement prints the data stored in country i.e. USA. Here outputFile opens the file in "w" write mode and writes the country name to the third line of the file.
d) 1.8 is written on line 4 of that file because of the following statement of above function:
print(height, file = outputFile)
This statement prints the value stored in height i.e. 1.8. Here outputFile opens the file in "w" write mode and writes the height value to the fourth line of the file.
e) 30 is written on line 5 of that file because of the following statement of above function:
print(age, file = outputFile)
This statement prints the value stored in age parameter of function saveUserProfile i.e. 30. Here outputFile opens the file in "w" write mode and writes the age value to the fifth line of the file.