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 09:50
Assume that you have an sorted array of records. assume that the length of the array (n) is known. give two different methods to search for a specific value in this array. you can use english or pseudo-code for your algorithm. what is the time complexity for each algorithm and why?
Answers: 1
question
Computers and Technology, 23.06.2019 15:30
Write a program in plp assembly that counts up by one starting from zero (or one) inside a loop and writes this value to the leds every time the value is increased. the memory address of the leds is 0xf0200000. the table below shows the meaning and an example usage of the instructions covered in the video, plp instructions for project 1. instruction example usage meaning load immediate li $t0, 8 register $t0 is set to the value, 8. store word sw $t2, 0($t1) the value in register $t1 is used as the memory address. the value in register $t2 is copied into this memory address. add addiu $t4, $t3, 29 register $t4 is assigned the sum of 29 and the value in register $t3. jump j your_label_name the program jumps to the line following the label, "your_label_name: ". label your label name: defines a label called "your_label_name: " that can be jumped to
Answers: 2
question
Computers and Technology, 23.06.2019 17:30
Write pseudocode to represent the logic of a program that allows the user to enter a value. the program multiplies the value by 10 and outputs the result.
Answers: 1
question
Computers and Technology, 24.06.2019 09:50
Self contained sequences of actions to be performed are? a. expressions b. algorithms c. functions d. formulas
Answers: 1
You know the right answer?
# [ ] Complete the following program to delete the first 10 files inside `files_exercises` (0.txt, 1...
Questions
question
History, 15.03.2020 01:57
question
History, 15.03.2020 01:59
question
Mathematics, 15.03.2020 01:59
Questions on the website: 13722363