Question

Written in python programming for MyProLab :) Please use simple code Assume the availability of a...

Written in python programming for MyProLab :) Please use simple code

Assume the availability of a function called printStars. The function receives an integer value as an argument. If the argument is positive, the function prints (to standard output) the given number of asterisks. Thus, if printStars(8) is called, ******** (8 asterisks) will be printed.

Assume further that the variable starCount has been declared and initialized with an integer value, possibly negative or zero.

Write some code that does nothing if starCount is not positive but that otherwise prints starCount asterisks to standard ouput by:

  • first printing a single asterisk (and no other characters)
  • then calls printStars to print the remaining asterisks
0 0
Add a comment Improve this question Transcribed image text
Answer #1

if(starCount>0):
    printStars(starCount)

Add a comment
Know the answer?
Add Answer to:
Written in python programming for MyProLab :) Please use simple code Assume the availability of a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Assume the availability of a function called printStars. The function receives an integer value as an...

    Assume the availability of a function called printStars. The function receives an integer value as an argument. If the argument is positive, the function prints (to standard output) the given number of asterisks. Thus, if printStars(8) is called, ******** (8 asterisks) will be printed. Assume further that the variable  starCount has been declared and initialized to contain a positive integer value. Write some code that prints starCount asterisks to standard output by: first printing a single asterisk and no other characters...

  • Write a python program (recursive.py) that contains a main() function. The main() should test the following...

    Write a python program (recursive.py) that contains a main() function. The main() should test the following functions by calling each one with several different values. Here are the functions: 1) rprint - Recursive Printing: Design a recursive function that accepts an integer argument, n, and prints the numbers 1 up through n. 2) rmult - Recursive Multiplication: Design a recursive function that accepts two arguments into the parameters x and y. The function should return the value of x times...

  • Please write this code in python programming and provide a screen short of the code. Reading:...

    Please write this code in python programming and provide a screen short of the code. Reading: P4E 7; Tut 7.2, 7.2.1 Upload an original Python script that satisfies the following criteria: It has at least two functions Function 1: This function has one parameter, a string containing the path to an existing text file that will be read by your function Using a with statement, the function opens the file indicated by the parameter for reading The function counts the...

  • DATA PROGRAMMING: PYTHON Be sure to use sys.argv NOT input. Write a program and create a...

    DATA PROGRAMMING: PYTHON Be sure to use sys.argv NOT input. Write a program and create a function called inch2cm that takes one number in inches as a parameter, converts it to the centimeters and prints the result. The program output is shown below. Input: 14 Output: 14 inches = 35.56 centimeter Write a program and create the following functions: shapes(): takes the shape name and a number as parameters, and calls the proper function to calculate the area. areaCircle(): take...

  • please help, language is python You’re creating a secret code to share with your friends such...

    please help, language is python You’re creating a secret code to share with your friends such that every word should be written with the second and last letters swapped. Write a function called encode that receives a string (input) and prints out another string with the second and last letters swapped. Example function calls: encode(secret) # should print “the code for secret is stcree” encode(city) # should print “the code for city is cyti”

  • Python 2.7.14 Programming Assignment Shape Drawing With Notepad++(PLEASE READ AND FOLLOW THESE INSTRUCTIONS THOROUGLY AS THIS...

    Python 2.7.14 Programming Assignment Shape Drawing With Notepad++(PLEASE READ AND FOLLOW THESE INSTRUCTIONS THOROUGLY AS THIS ASSIGNMENT IS FOR PYTHON 2.7.14. ONLY AND I REALLY NEED THIS TO WORK!!! ALSO PLEASE HAVE THE CODE PROPERLY INDENTED, WITH WHATEVER VARIABLES DEFINED, WHATEVER IT TAKES TO WORK FOR PYTHON 2.7.14. I feel like nothing I do is working and I'm trying everything I can think of. ): In this assignment, the student will create a Python script that implements a series of...

  • Please use python 3 programming language Write a function that gets a string representing a file...

    Please use python 3 programming language Write a function that gets a string representing a file name and a list. The function writes the content of the list to the file. Each item in the list is written on one line. Name the function WriteList. If all goes well the function returns true, otherwise it returns false. Write another function, RandomRange that takes an integer then it returns a list of length n, where n is an integer passed as...

  • python 3 please, for these questions you do not need to write the whole code just...

    python 3 please, for these questions you do not need to write the whole code just the expression 1)Write a loop that reads positive integers from standard input, printing out those values that are greater than 100, each on a separate line, The loop terminates when it reads an integer that is not positive. 2) Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive. After the loop...

  • This is for programming using Python with the JES software. Please write the code with the...

    This is for programming using Python with the JES software. Please write the code with the proper indentation. Thanks! Problem 1: Write a function that takes 2 arguments (integer or float) and computes the sum, difference, product, and quotient of the arguments. Once you calculate the values you should print out statements telling the user what arguments we used to compute the values and what the result of each calculation (your function should produce 5 lines of output in the...

  • Python 3 code Write a function named coinflip that accepts an input called flips. The function...

    Python 3 code Write a function named coinflip that accepts an input called flips. The function should sim-ulate flipping a coin flips times. The function should return True if the coin was the same result for every flip. You can assume the function receives a positive integer as input. Write a second function named simulation that runs trials of the coin flip experiment. simulation should accept two parameters: the number of trials, and the number of coin flips to do...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT