Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 Files 1. Create a text file, my_file.txt, and write 3 interesting facts about python into it (you may use python, or nano, or any
1 Files 1. Create a text file, my_file.txt, and write 3 interesting facts about python into it (you may use python, or nano, or any means you choose to create the file). For example the file might contain: Python is named after Monty Python Python has a Zen of Python etc In python, write code that uses a loop to read the contents of the file and prints each line. 2. Write a Python program to write the elements of the list color = ['Red', 'Green', 'White', 'Black','Pink', 'Yellow'], to a file called "color_list_file.txt", with each element in a new line. 3. Now, write code that reads all lines from a "color_list_file.txt" except line 5 and print the colors 4. Read the contents of the file "color_list file.txt" and print the number of letters in its contents. 5. print the count of the number of files in your current working directory. 6. write a program that gets the name and age of a person and stores it into a dictionary with name and age as the keys. Get age and name input data from 5 users, and store it in a new file called data.txt. To verify your work, write code that reads data.txt and prints out the people and their ages. 7. create a file called lines.txt which contains the following lines: line1 line 2 line3 write a program which converts the content into the following: line 3 this line has been inserted via Python code line2 line1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started