Answer the following questions then confirm with your neighbor:
- What are the 4 steps of working with a file?
Write one or more python scripts to illustrate the following:
- Write your name on one line and something amazing about you on another line to a file named "personalInfo.txt" and close the file
- Using a while loop, read each line of the file "personalInfo.txt" and print out it's contents
- Using a for loop, read each line of the file "personalInfo.txt" and print out it's contents
Write one or more python scripts to illustrate the following:
- Choose a random number, x. Write x random numbers between 0.0 and 1.0 to a file named "randomNumbers.txt". Make sure to follow the 4 steps for working with a file.
- Using a while loop, read each line of the file "randomNumbers.txt" and print out it's contents
- Using a for loop, read each line of the file "randomNumbers.txt" and print out it's contents