1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
mr Goodwill [35]
2 years ago
12

Write a Python program that takes a file name as input and generates the following output: File size in bytes and KBs Time the f

ile is created in human readable format (i.e., not a timestamp) Last time the file is accessed and modified, also in human readable format First character, middle character (2 character is even size), and last character Number of words in the file Number of lines in the file
Computers and Technology
1 answer:
Airida [17]2 years ago
8 0

Answer:

See explaination

Explanation:

import os

import time

from stat import *

file = input("Enter file name: ")

details = os.stat(file)#stores statistics about a file in a directory

print("File size: ", details[ST_SIZE])#retreiving size

print("File last accessed time: ", time.asctime(time.localtime(details[ST_ATIME])))#access time

print("File last modified time: ", time.asctime(time.localtime(details[ST_MTIME])))#modified time

print("File creation time: ", time.asctime(time.localtime(details[ST_CTIME])))#creation time

print("First character: ", file[0])

print("Middle character: ", file[len(file) // 2])

print("Last character: ", file[len(file) - 1])

num_words = 0

num_lines = 0

f=open(file, "r")

lines = f.readlines()

for line in lines:

num_lines = num_lines + 1

num_words = num_words + len(line.split())#add no. of words in that line

print("Number of lines: ", num_lines)

print("Number of words: ", num_words)

You might be interested in
Task 2 Design a 1st order low-pass filter with cutoff frequency 1kHz, 1) with roll-off and 2) without roll-off. For each filter,
miskamm [114]

You can get complete answer in attached document.please have a look.

Explanation:

(2) Without rolloff, as given fc =1kHz Let us assume it is a first order RC filter ats transfer function is H(s)-RC RC withou

Then the transfer function becom

and step response is flat zero for without rolloff..

6 0
3 years ago
A corporate or government network that uses Internet tools, such as Web browsers, and
Alchen [17]

Answer: Intranet

Explanation:

The options include:

A. extranet.

B) social network.

C) intranet.

D) e-market.

A corporate or government network that uses Internet tools, such as Web browsers, and Internet protocols is referred to as intranet.

Social networks are social media sites that are used by people which allows them to stay connected with one another.

E-market is a form of marketing whereby goods and services are promoted or advertised through the use of the internet.

Therefore, the answer to he above question is intranet.

3 0
3 years ago
The causes of making computer virus​
sasho [114]

Answer:

Damage and chaos. ...

An ego stroke. ...

Monetary or information gain. ...

Stealth. ...

Prevention.

To take control of a computer and use it for specific tasks.

To generate money.

To steal sensitive information (credit card numbers, passwords, personal details, data etc.)

To prove a point, to prove it can be done, to prove ones skill or for revenge purposes.

To cripple a computer or network.

Explanation:

5 0
3 years ago
Read 2 more answers
An important task that the operating system performs is ____, which keeps track of the files stored on a computer so that they c
finlep [7]
#1) An important task that the operating system performs is ____, which keeps track of the files stored on a computer so that they can be retrieved when needed.
Answer: File Management System. Keeps track of where files are stored and determines how the files are stored following the operating system file allocation policies. It uses available storage space efficiently for files and creates a record/log of all file usage. It allocates a file to a user if is free, and if they are permitted access to it. Then de-allocates file when the user is finished with it.
8 0
3 years ago
Which element of presentation software can you use to add callouts and banners?
Harrizon [31]
<span><span>1.)From the Insert tab, select the Shapes command. A drop-down menu will appear.
</span><span>2.)Select the desired shape
3.)</span></span>Click and drag<span> the slide to create the shape. You may need to move or resize the shape so it points to the desired part of the image.
4.)</span><span>f you want your callout to contain text, start typing while the shape is selected.
5.)</span><span>From the </span>Format<span> tab, you can use the options in the </span>Shape Styles<span> group to customize the appearance of the shape. You can also adjust the font from the Home tab</span>
7 0
2 years ago
Read 2 more answers
Other questions:
  • You are tasked with setting up an employee’s computer.Instead of a new computer,she will be using a computer with an older opera
    11·2 answers
  • Categories of general purpose application software and examples each​
    13·1 answer
  • A computer has a word length of 8 bits (including sign). if 2’s complement is used to represent negative numbers, what range of
    5·1 answer
  • Why is the stateless nature of the internet a problem for shopping cart software? g?
    5·2 answers
  • After you post a video of yourself defacing school property You can likely expect that
    11·2 answers
  • Jin needs to add a row into his spreadsheet, but he does not want to remove any existing data. Which combination of options shou
    6·2 answers
  • A port is the point at which a peripheral device attaches to or communicates with a computer or mobile device. True False
    15·1 answer
  • How many of you got the right answer from this app​
    8·1 answer
  • David plays racing games on his way to work. He uses the analog stick to navigate his vehicle through other artificial intellige
    7·2 answers
  • Difine the term pigment​
    14·3 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!