Computers and Technology
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

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 22:50, youngboymark123
Assume the existence of a bankaccount class. define a derived class, savingsaccount that contains two instance variables: the first a double, named interestrate, and the second an integer named interesttype. the value of the interesttype variable can be 1 for simple interest and 2 for compound interest. there is also a constructor that accepts two parameters: a double that is used to initialize the interestrate variable, and a string that you may assume will contain either "simple", or "compound", and which should be used to initialize the interesttype variable appropriately. there should also be a pair of functions getinterestrate and getinteresttype that return the values of the corresponding data members (as double and int respectively).
Answers: 2
image
Computers and Technology, 23.06.2019 06:00, jack487
How can a user delete a drawing object
Answers: 1
image
Computers and Technology, 23.06.2019 22:20, Izzyfizzy
Read “suburban homes construction project” at the end of chapters 8 and 9 (in the textbook) and then develop a wbs (work breakdown structure) in microsoft excel or in microsoft word (using tables)
Answers: 1
image
Computers and Technology, 23.06.2019 23:30, yasarhan2
Match the following errors with their definitions. a. #name b. #value c. #ref d. 1. when a formula produces output that is too lengthy to fit in the spreadsheet cell 2. when you enter an invalid cell reference in a formula 3. when you type text in cells that accept numeric data 4. when you type in a cell reference that doesn’t exist
Answers: 1
Do you know the correct answer?
# [ ] Complete the following program to delete the first 10 files inside `files_exercises` (0.txt, 1...

Questions in other subjects:

Konu
Mathematics, 08.12.2020 20:10