File Exercises 1

Answer the following questions then confirm with your neighbor:
  1. What are the 4 steps of working with a file?
Write one or more python scripts to illustrate the following:
  1. Write your name on one line and something amazing about you on another line to a file named "personalInfo.txt" and close the file
  2. Using a while loop, read each line of the file "personalInfo.txt" and print out it's contents
  3. 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:
  1. 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.
  2. Using a while loop, read each line of the file "randomNumbers.txt" and print out it's contents
  3. Using a for loop, read each line of the file "randomNumbers.txt" and print out it's contents