Write the python statement that will print the number

Assignment Help Computer Engineering
Reference no: EM132173768

Using python 3.

1)Suppose a program that uses command line arguments starts with the following line: import sys . Write the Python statement that will print the number of arguments that were provided on the command line.

2}Suppose the user intends to run the program by supplying command-line arguments , where an operation is supplied (capitalize, lowercase, count) followed by any number of strings. capitalize: changes all letters in the word to uppercase, lowercase: changes all letters in the word to lowercase,count: returns a count of all of the letters in the strings. Write a program that processes the command line arguments correctly.

Examples:

python myProg.py capitalize This is easy output would be THIS IS EASY
or
python myProg.py lowercase This WAS easy as Pie output would be this was easy as pie
or
python myProg.py count This WAS, easy! as Pie. output would be 16
or
python myProg.py lower This WAS easy as Pie output would be " Invalid operation"

3)Write a Python program that accepts the number of scores followed by that many scores via the command line and prints the average of the scores. Include appropriate error-checking to make sure command line arguments are provided. No other error checking is required.

Example1: python calcAvg.py 5 100 90 70 80 90

Output of the code should be: Average: 87

Example2: python calcAvg.py 3 100 90 80

Output of the code should be: Average: 90

Example 3: python calcAvg.py

Output of the code should be: No scores were provided - average cannot be calculated.

4)Suppose the user is expected to supply words on the command line as shown below:

Example: python myProg.py hello there

Output of the code should be:

Average word length: 5 Number of Vowels: 4

Write Python code to correctly produce the output shown.

Reference no: EM132173768

Questions Cloud

Present all the relevant hypotheses : Completed a factorial experiment to see if scores on exams are affected by gender and teaching methods. The data system appears below.
Find the p-value for your test statistic : Solve using the Traditional Method. Find the p-value for your test statistic.
Create a loop that counts the number of digits in p : Create a loop that counts the number of digits in p. The in-built method Character.isDigit(p.charAt(index)) returns true if p.charAt(index) is a digit.
Average movie budget : Test to determine if action movies cost more than the average movie budget. Solve using the Traditional Method. Use a= .05.
Write the python statement that will print the number : Write the Python statement that will print the number of arguments that were provided on the command line.
??what proportion of 1040r tax forms : ??What proportion of 1040R tax forms will be completed in less than 97 minutes?
Write a function that takes one string parameter : Write a function named wordLenghts() that takes one string parameter (text)you may assume that the given text contains only letters.
Upper limit of the confidence : If we construct a 99% confidence interval of the average amount spent per year by companies on staff training, what is the upper limit of the confidence
Write a function that takes one string parameter : Write a function named wordLenghts() that takes one string parameter (text)you may assume that the given text contains only letters.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd