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, 24.06.2019 09:00
Why might you chose to crest a function resume
Answers: 1
question
Computers and Technology, 24.06.2019 13:00
What are some websites that you can read manga (ex: manga rock)
Answers: 1
question
Computers and Technology, 24.06.2019 21:30
Suppose a router has built up the routing table shown in the table. subnet number 128.96.39.00 28.96.39.128 128.96.40.00 192.4.153.0 default) subnet mask 255.255.255.128 255.255.255.128 255.255.255.128 255.255.255.192 nexthop interface 0 interface 1 r2 r3 r4. the router can deliver packets directly over interfaces 0 and 1, or it can forward packets to routers r2, r3, or r4. describe what the router does with a packet addressed to each of the following destinations: (a) 128.96.39.10 (b) 128.96.40.12 (c) 128.96.40.151 (d) 192.4.153.17 (e) 192.4.153.90
Answers: 3
question
Computers and Technology, 25.06.2019 02:30
What group of plants produce fruit? question 2 options: gymnosperms nonvascular plants seedless vascular plants angiosperms
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
Mathematics, 06.12.2021 20:40
question
Mathematics, 06.12.2021 20:40
question
Arts, 06.12.2021 20:40
question
Physics, 06.12.2021 20:40
Questions on the website: 13722363