subject
Computers and Technology, 04.11.2021 07:10 ohgeezy

# [ ] Complete the following program to delete the first 10 files inside `files_exercises` (0.txt, 1.txt ... 9.txt) # Make sure the to run the environment setup code before running your own program.

import os

if ('files_exercises' not in os. getcwd()):
print("STOP Run the environment setup code!")

# list the content of `files_exercises`
print('Content of "files_exercises" before removing the files')
print(os. listdir())

#TODO: delete the first 10 files

# [ ] Write a program to delete all the even numbered files inside `files_exercises`
# Make sure the to run the environment setup code before running your own program.

import os
os. mkdir('files__exercises')
if ('files__exercises' not in os. getcwd()):
print("STOP Run the environment setup code!")

#TODO: Your code goes here

# [ ] Write a program to delete all the directories inside `files_exercises`
# Make sure the to run the environment setup code before running your own program.

import os

if ('files_exercises' not in os. getcwd()):
print("STOP Run the environment setup code!")

#TODO: Your code goes here

# [ ] Write a program to ask the user for a file number,
# then delete the file if it exists or display an appropriate error message if it does not.
# Make sure the to run the environment setup code before running your own program.

# Test your program with the following:
# case 1: user inputs 84, 84.txt should be deleted
# case 2: user inputs 84 (again), a File does not exist message is printed
# case 3: user inputs 5, 5.txt should be deleted

import os

if ('files_exercises' not in os. getcwd()):
print("STOP Run the environment setup code!")

#TODO: Your code goes here

# [ ] Write a program to ask the user for a file number,
# then delete the file if it exists or display an appropriate error message if it does not.
# Use file exception handling instead of file existence tests.
# Make sure to run the environment setup code before running your own program.

# Test your program with the following:
# Case 1: When the user inputs 84, the program should delete the file 84.txt
# Case 2: When the user inputs 84 (again), the program should print a File Not Found error message
# Case 3: When the user inputs 5, the program should delete the file 5.txt

import os

if ('files_exercises' not in os. getcwd()):
print("STOP Run the environment setup code!")

#TODO: Your code goes here

# [ ] Write a program to print the first line of every file inside `files_exercises`
# Use a `with` statement to open (and close) every file
# Make sure the to run the environment setup code before running your own program.

import os

if ('files_exercises' not in os. getcwd()):
print("STOP Run the environment setup code!")

#TODO: Your code goes here

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 08:30
Active listen eliminates barries to communication true or false
Answers: 1
question
Computers and Technology, 22.06.2019 12:30
What characteristic of long period comets suggest they come directly from the oort cloud?
Answers: 2
question
Computers and Technology, 23.06.2019 03:00
Jason, samantha, ravi, sheila, and ankit are preparing for an upcoming marathon. each day of the week, they run a certain number of miles and write them into a notebook. at the end of the week, they would like to know the number of miles run each day, the total miles for the week, and average miles run each day. write a program to them analyze their data. your program must contain parallel arrays: an array to store the names of the runners and a two-dimensional array of five rows and seven columns to store the number of miles run by each runner each day. furthermore, your program must contain at least the following functions: a function to read and store the runners’ names and the numbers of miles run each day; a function to find the total miles run by each runner and the average number of miles run each day; and a function to output the results. (you may assume that the input data is stored in a file and each line of data is in the following form: runnername milesday1 milesday2 milesday3 milesday4 milesday5 milesday6 milesday7.)
Answers: 3
question
Computers and Technology, 23.06.2019 07:10
If you want to import a picture into a dtp application, what must you do first? draw an image frame. import text. open the folder containing the file. select get image… from the windows menu.
Answers: 2
You know the right answer?
# [ ] Complete the following program to delete the first 10 files inside `files_exercises` (0.txt, 1...
Questions
question
Mathematics, 27.05.2021 23:10
question
Mathematics, 27.05.2021 23:20
question
Mathematics, 27.05.2021 23:20
Questions on the website: 13722363