[solved]-Code Four Exercises Duplicated Convenience 31 11 Det Saveuser Info Username Value Password Q39026911



The code below is the same in all four exercises. It is duplicated for your convenience. 31 11 det saveUser Info (username, value, password): 21 usernameFile = open(“Username.txt”, “”) account ValueFile = open(“Account Value.txt”, “U”) passwordFile = open(“Password, txt”, “”) usernaneFile.vrite(username) accountValueFile.write(value) passwordFile.write(password) usernameFile.close() account ValueFile.close() passwordFile.close() 111 121 saveUserInfo(Ramblinllreck 20″, 222, “burd311”) 101 Assume that we applied one of the fixes to the previous code. After applying that fix, what will be the contents of each of the three files once the code has run? Username.txt AccountValue.txt Dard.txt Imagine we added two more lines to the end of the code above: 131 taveUser Into(“Spurstan14”, str(150), “Ginobila!”) 141 saveUserInfo(“Jolteon 11”. str(225), “thunderbolt” After the entire code runs, what is the contents of each of the three files? If the files will have multiple lines with text, write “in” between them. For example, if the contents of Username.bit was: ATLUTD Ver GLA. 1962 Your answer would be: ATLUTD 4evernGEA. 1962 Userna.it Account Value Password.txt 11. def saveUser Profile (firstName, last Name, age, height, country) 21 filename = lastName + firstName + “.txt” output File = open(filename, “”) print (lastName, file = output File) print (firstName, file – output File) print (country, file = output File) print (height , file output File) print (age, tile – output File) output File.close() 31 41 51 81 91 Above is a function that takes five pieces of information about a user and saves that data to a file. We’ll assume firstName, lastName, and country are strings, age is an integer, and height (expressed in meters) is a float Assume we call the function above with this line of code: saveUser Profile(“David”, “Joyner, 30, 1.3, “USA”) After the function runs, what is name of the file that is created? What is written on line 1 of that file? If there is no line 1 or if line 1 is blank, enter Nothing What is written on line 2 of that file? If there is no line 2 or if line 2 is blank, enter Nothing What is written on line 3 of that file? If there is no line 3 or if line 3 is blank, enter Nothing What is written on line 4 of that file? If there is no line 4 or if line 4 is blank, enter Nothing What is written on line 5 of that file? If there is no line 5 or if line 5 is blank, enter Nothing 0.0/2.0 points (graded Imagine that we made the following four calls to saveUser Profile() one after the other: saveUser Profile(“David”, “Joyner”, 30, 1.8, “USA) saveUser Profile(“Haria”, “Garcia”, 25, 1.6, “Chile”> saveUser Profile(“Aditya”, “Kaur”, 51, 1.7, “India”) saveUser Profile(“Maria”, “Garcia”, 32, 1.7, “Chile”) How many files would be created by this code? 20 If the files were sorted alphabetically, what would be the first filename listed? Aditya If the files were sorted alphabetically, what would be the second filename listed [Chile Chile If the files were sorted alphabetically, what would be the third filename listed Chile Which file would be listed as having been modified most recently? USA Show transcribed image text The code below is the same in all four exercises. It is duplicated for your convenience. 31 11 det saveUser Info (username, value, password): 21 usernameFile = open(“Username.txt”, “”) account ValueFile = open(“Account Value.txt”, “U”) passwordFile = open(“Password, txt”, “”) usernaneFile.vrite(username) accountValueFile.write(value) passwordFile.write(password) usernameFile.close() account ValueFile.close() passwordFile.close() 111 121 saveUserInfo(Ramblinllreck 20″, 222, “burd311”) 101 Assume that we applied one of the fixes to the previous code. After applying that fix, what will be the contents of each of the three files once the code has run? Username.txt AccountValue.txt Dard.txt
Imagine we added two more lines to the end of the code above: 131 taveUser Into(“Spurstan14”, str(150), “Ginobila!”) 141 saveUserInfo(“Jolteon 11”. str(225), “thunderbolt” After the entire code runs, what is the contents of each of the three files? If the files will have multiple lines with text, write “in” between them. For example, if the contents of Username.bit was: ATLUTD Ver GLA. 1962 Your answer would be: ATLUTD 4evernGEA. 1962 Userna.it Account Value Password.txt
11. def saveUser Profile (firstName, last Name, age, height, country) 21 filename = lastName + firstName + “.txt” output File = open(filename, “”) print (lastName, file = output File) print (firstName, file – output File) print (country, file = output File) print (height , file output File) print (age, tile – output File) output File.close() 31 41 51 81 91 Above is a function that takes five pieces of information about a user and saves that data to a file. We’ll assume firstName, lastName, and country are strings, age is an integer, and height (expressed in meters) is a float Assume we call the function above with this line of code: saveUser Profile(“David”, “Joyner, 30, 1.3, “USA”) After the function runs, what is name of the file that is created? What is written on line 1 of that file? If there is no line 1 or if line 1 is blank, enter Nothing What is written on line 2 of that file? If there is no line 2 or if line 2 is blank, enter Nothing What is written on line 3 of that file? If there is no line 3 or if line 3 is blank, enter Nothing What is written on line 4 of that file? If there is no line 4 or if line 4 is blank, enter Nothing What is written on line 5 of that file? If there is no line 5 or if line 5 is blank, enter Nothing
0.0/2.0 points (graded Imagine that we made the following four calls to saveUser Profile() one after the other: saveUser Profile(“David”, “Joyner”, 30, 1.8, “USA) saveUser Profile(“Haria”, “Garcia”, 25, 1.6, “Chile”> saveUser Profile(“Aditya”, “Kaur”, 51, 1.7, “India”) saveUser Profile(“Maria”, “Garcia”, 32, 1.7, “Chile”) How many files would be created by this code? 20 If the files were sorted alphabetically, what would be the first filename listed? Aditya If the files were sorted alphabetically, what would be the second filename listed [Chile Chile If the files were sorted alphabetically, what would be the third filename listed Chile Which file would be listed as having been modified most recently? USA
Expert Answer
Answer to The code below is the same in all four exercises. It is duplicated for your convenience. 31 11 det saveUser Info (userna… . . .
OR

