subject

# program-01-steps Using steps. py in this repository for a starter file, write a Python program to calculate average number of steps per month for a year.
The input file (which you will read from the command line, see the sample program on how to read command line arguments in this repository) contains the number of steps (integer) a person took each day for 1 year, starting January 1. Each line of input contains a single number.
Assume this is NOT a leap year.
Your output must follow this format:
```
The average steps taken in MONTH NAME was 9999.9
```
Where 9999.9 represents that month's average. Be sure to output only a single decimal digit (digit to the right of the decimal)
Be sure to spell out the name of the month. First letter must be caps. For example: June
For a grade of A your program should handle a leap year by looking at the number of steps in the file, if 365 then non leap year, if 366 then leap year.
***commandlines. py***
# Python program to demonstrate
# command line arguments
# notice that the first command line argument that is passed to a program comes after the name of the program file
# it has an array index of 1 in the sys. argv array
# sys. arg[0] is always the name of the python program file
# all command line arguments are strings, so if you want to perform math you have to convert

import sys
# total arguments
n = len(sys. argv)
print("Total arguments passed: %i" % n)
# Arguments passed
print("\nName of Python script: %s" % sys. argv[0])
print("\nArguments passed:")
for i in range(1, n):
print("%s" % sys. argv[i])
# Addition of numbers
Sum = 0
for i in range(1, n):
Sum += int(sys. argv[i])
print("\n\nResult: %i" % Sum)
***steps. py***
# Named constants - create one for each month to store number of days in that month; assume this is NOT a leap year
def main():
# Open the steps file using the first command line argument to get the input file name. For example: python steps. py steps. txt would open the file steps. txt to read the steps
# Display the average steps for each month using a function to calculate and display
# Close the file.
def average_steps(steps_file, month_name, days):
# compute the average number of steps for the given month
# output the results
main()

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:30
You are almost finished updating a web site. as part of the update, you have converted all pages from html 4.0 to html5. the project is currently on schedule. however, your project manager has been asked by the marketing team manager to justify a day of time spent validating the site's html5 pages. the marketing team manager does not have technical knowledge of the internet or the web. which is the most appropriate explanation to provide to the marketing team manager?
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
Quic which one of the following is the most accurate definition of technology? a electronic tools that improve functionality b electronic tools that provide entertainment or practical value c any type of tool that serves a practical function d any type of tool that enhances communication
Answers: 1
question
Computers and Technology, 23.06.2019 12:00
Using the list, you can select the number of photos that will appear on each slide. a. theme b. frame shape c. pictures in album d. picture layout
Answers: 1
question
Computers and Technology, 23.06.2019 19:00
This question involves a class named textfile that represents a text file. public class textfile { private string filename; private string filename; private arraylist words; // constructors not shown // postcondition: returns the number of bytes in this file public int filesize() { } // precondition: 0 < = index < words.size() // postcondition: removes numwords words from the words arraylist beginning at // index. public void deletewords(int index, int numwords) { } // precondition: 0 < = index < = words.size() // postcondition: adds elements from newwords array to words arraylist beginning // at index. pub lic voidaddwords(int index, string[] newwords) { } // other methods not shown } complete the filesize() method. the filesize() is computed in bytes. in a text file, each character in each word counts as one byte. in addition, there is a space in between each word in the words arraylist, and each of those spaces also counts as one byte. for example, suppose the words arraylist stores the following words: { mary had a little lamb; its fleece was white as snow. } the filesize() method would compute 4 + 3 + 1 + 6 + 5 + 4 + 6 + 3 + 5 + 2 + 5 as the sum of the lengths of each string in the arraylist. the value returned would be this sum plus 10, because there would also be 10 spaces in between the 11 words. complete the filesize() method below: // postcondition: returns the number of bytes in this file public int filesize() { }
Answers: 1
You know the right answer?
# program-01-steps Using steps. py in this repository for a starter file, write a Python program t...
Questions
Questions on the website: 13722363