Write a function number_of_pennies() that returns the total number of pennies given a number of dollars and (optionally) a number of pennies. Sample output with inputs: 5 6 4 506 400 1 | 2 print(number_of_pennies(int(input()), int(input()))) # Both dollars and pennies 3 print(number_of_pennies(int(input()))) # Dollars only
Q: Write a program that calculates the monthly pay for a salesperson. A person's pay is equal to his or…
A: Solution: Note : Complete executable C++ code is attached at "Step-6". 1. Implementation of…
Q: Write a function for a simple game for two players that will generate a random 4 digit number (not…
A: Program Approach: Firstly using the package. Then using the namespace. Define the main Class.…
Q: In Python Define function print_popcorn_time() with parameter bag_ounces. If bag_ounces is less…
A: PROGRAM: #Defining print_popcorn_time() def print_popcorn_time(bag_ounces): #If user's input is…
Q: Write a function number_of_pennies() that returns the total number of pennies given a number of…
A: Total number of pennies = number of dollars * 100 + pennies
Q: Write the function int isEven (int x); that returns 1 if x is an even number; otherwise, it returns…
A: please check the step 2 for required c++ code and step 3 for output.
Q: Write a function “func(n)” that returns the number of values generated until all values are obtained…
A: To write a function that returns the number of values generated using Harmonic.
Q: Write a function that makes the first number as large as possible by swapping out its digits for…
A: function maxPossible(n1, n2) { arr1 = n1.toString().split('') arr2 =…
Q: Write a function that receives 3 assignment grades, a1, a2, a3, and a final grade, f, for a student…
A: #include <iostream> #include<cmath> using namespace std; double gradeCalc(int a1, int…
Q: (Use function) Write a function-oriented program that scans a number n and then output the sum of…
A: Algorithm : exponential function : Step 1 : declare variables. Step 2 : initialize variable to 0.…
Q: Write a function to simulate coin tossing, the function will use rand function that gives an output…
A: Source code: //toss() function to get the result of tossing a coin #include<stdio.h>int…
Q: Write a function print_shampoo_instructions() with parameter num_cycles. If num_cycles is less than…
A: Solution :
Q: The following function prints the powers of 2 from 1 through n (inclusive). For example, if n is 4,…
A:
Q: Given two integers x snf y, the following recurrsive definition determined the greatest common…
A: Note-since programming language is not specified so we are providing solution in python programming…
Q: Write a function print_shampoo_instructions() with parameter num_cycles. If num_cycles is less than…
A: Algorithm: if num_cycle is less than 1 print too few if num_cycle is greater than 1 print too many…
Q: python Write a function shampoo_instructions() with parameter num_cycles. If num_cycles is less…
A: Corrected program code: def shampoo_instructions(user_cycles): if user_cycles<1: print('Too…
Q: Define a function print_total_inches, with parameters num_feet and num_inches, that prints the total…
A: Program code: #define the function print_total_inches()def print_total_inches(num_feet, num_inches):…
Q: Consider the program segment below. #include int Sum(int,int); void main() { int a 10, b = 6; int…
A: Below I have provided C Programming. Also, I have attached the screenshot of the code and output of…
Q: Write a function num digits that takes a number, and returns the count of digits in the number. For…
A: Introduction of the Program: The Python code creates a function that takes a number as a parameter…
Q: Define a function print_total_inches, with parameters num_feet and num_inches, that prints the tot…
A:
Q: Implement a C function, named triangle, that outputs Pascal's triangle. An example is provided…
A: #include < stdio.h > long factorial(int); int main() { int i, n, c;…
Q: Write a function print_daily_totals(rainfalls) that prints the total rainfall for each day of…
A: #note no programming language is mentioned so i was used python programing def…
Q: An integer number is said to be a perfect number if its factors, including 1 (but not the number…
A: A perfect number is a number where the value of the number itself can be obtained summing up all its…
Q: Write a program c++ that prints a receipt with the following information. Let the program has the…
A: Step 1 : Start Step 2 : Define a Function printMenu() to print the Menu. Step 3 : In the main…
Q: Write a function PrintShampooInstructions(), with int parameter numCycles, and void return type. If…
A: Completing the given C++ program so, that it can follow the given rubrics:Firstly, displaying a…
Q: Write a function get_names(), which prompts the user for a sequence of names, where each name can…
A: Note: Since no programming language is mentioned. I am attempting this in python. if you need it in…
Q: Given a number N (>0). Write a c++ function to find a digit whose frequency is maximum. Function…
A: Program: Programs are used to provide instructions to the computer system in order to solve complex…
Q: Define a function calc_total_inches, with parameters num feet and numunches, that returns the total…
A: - We have to code for the total number of inches with the feet and inch as the parameters as the…
Q: Write a function that takes a list of hours and returns the total weekly salary. • The input list…
A: 1. Create the Method with the argument of the list of hours 2. return hours with function switch(i)…
Q: write a function get_intersecting_station(line_one, line_two) where line_one and line_two are the…
A: Required: write a function get_intersecting_station(line_one, line_two) where line_one and…
Q: Write a function cube that returns the cube of the float given as argument (use multiplication,…
A: In step 2, you will get C++ code. In step 3, you can see the sample output.
Q: Define a function print_total_inches, with parameters num_feet and num_inches, that prints the total…
A: #get feed and inches values from user and convert to intfeet = int(input())inches = int(input())…
Q: Write a function NumberOfPennies() that returns the total number of pennies given a number of…
A: Program: #include <iostream>using namespace std;int NumberOfPennies(int NumberOfDollars, int…
Q: Write a function num_digits that takes a number, and returns the count of digits in the number. For…
A: Here we need to count the number of digits, So, divide the number by 10 till it becomes 0 and the…
Q: Write and execute a program to do the following: - 1) Ask the user the user to input marks in…
A: (1)Read the number of students(2)Create an empty list(3)Loop to read the marks of a student…
Q: Write a program to calculate n! for a given number n and perform the simple calculator operations.…
A: I'm given a Working code implemented in C and appropriate comments are provided for better…
Q: Write a function median : int * int * int -> int that returns the median value of the input. You may…
A: fun median(a,b,c) = if a > b if a < c…
Q: Write a function to find the best exchange rate from one currency to another currency: Given list…
A: Python Code: from collections import defaultdictfrom collections import deque # convert functiondef…
Q: Write a function qualityPoints that inputs a student’s average and returns 4 if a student's average…
A: #include <stdio.h>//function to take student average//and returns qualityPoints based on…
Q: Suppose that you are a teacher, depending on the number of students taking your course, write a…
A: MATLAB codec :- names={};grades=[];maxx=0;pos='';summ=0;fprintf("Enter Number of students…
Q: Write a function shampoo_instructions() with parameter num_cycles. If num_cycles is less than 1,…
A: Q: Write function for given definition. (language: python)
Q: 9. Write three functions that are the “inverses" of to_secs: (a) hours_in returns the whole integer…
A: def hours_in(s): h = s // (60 * 60) return h
Q: Write a function that receives a positive integer n as a parameter, then it must calculate the sum…
A: There is no specific language mentioned used c++ algorithm step 1: start step 2: create a function…
Q: Consider this very simple function: def cube(x): answer = x*X*X return answer a) Here is a fragment…
A: Lets analyse the given code: def cube(x): #takes variable x as input argument answer =…
Q: Write a program that will: • Select a random number between 1 and 100. • Test if the number is prime…
A: Written code in Python since no programming language was mentioned - from random import *…
Q: Write a function to check if a given input number is a jumping number. A number is called jumping…
A: Since no programming language is mentioned, I am using python. Code: def checkJump(n): flag=1…
Q: Given a number N (>0). Write a c++ function to find a digit whose frequency is maximum. Function…
A: PROGRAM CODE: #include <bits/stdc++.h> // include header file for input output…
Q: Write a program that works with fractions. Your program should be able to add,subtract, multiply,…
A: PROGRAMMING APPROACH: Define the necessary header file using namespace. Define the function…
Q: Write a function that keeps computing the sum of the digits of x^n, until there is only one digit…
A: Algorithm Start Var a, b Call function f=func(a, b) Print(f) Stop Function func(a, b) Start…
Q: Exercise: Write a program to compute the result of dividing two positive integers and the remainder…
A: Please refer below for your reference: Language used is C++: I have used the algorithm referenced in…
The coding language is python and the code written was provided to us
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
- Write a program that takes as input five numbers and outputs the mean (average) and standard deviation of the numbers. If the numbers are x1,x2,x3,x4,andx5, then the mean is x=(x1+x2+x3+x4+x5)/5 and the standard deviation is: s=(x1x)2+(x2x)2+(x3x)2+(x4x2)+(x5x2)5 Your program must contain at least the following functions: a function that calculates and returns the mean and a function that calculates the standard deviation.Write a function print_shampoo_instructions() with parameter num_cycles. If num_cycles is less than 1, print "Too few.". If more than 4, print "Too many.". Else, print "N : Lather and rinse." num_cycles times, where N is the cycle number, followed by "Done.".Sample output with input: 2 1 : Lather and rinse. 2 : Lather and rinse. Done. Hint: Define and use a loop variable. ''' Your solution goes here ''' user_cycles = int(input())print_shampoo_instructions(user_cycles)Write a function rps in Python that returns the result of a game of "Rock,Paper, Scissors". The function accepts two arguments, each one of 'R','P','S' , that represents the symbol played by each of the two players. The function returns: -1 if the first player wins0 if a tie1 if the second player winsScissors beats Paper beats Rock beats Scissors Sample usage: >>> rps('R','P') # player 2 wins, return 11
- Description F(x) = x + 1 G(x, y) = x + y Please write a program to calculate the value of composite of F and G Input Input will be the composite of F and G. The parameter of F and G are integer only. Output An integer represent the value of function. Sample Input 1 F(G(1,F(3))) Sample Output 1 6Write a function number_of_pennies() that returns the total number of pennies given a number of dollars and (optionally) a number of pennies.input: 5 6 4 Output: 506 400 My Code: def number_of_pennies(dollars=0, pennies=0): numer_of_pennies = (dollars * 100) + pennies return number_of_pennies print(number_of_pennies(int(input()), int(input()))) # Both dollars and penniesprint(number_of_pennies(int(input()))) # Dollars only However, this is the output that I am getting: <function number_of_pennies at 0x7f6a5e1d7e50> <function number_of_pennies at 0x7f6a5e1d7e50>An integer number is said to be a perfect number if its factors, including 1 (but not the number itself), sum to the number. For example, 6 is a perfect number because 6 =1 + 2 + 3. Write a function perfect that determines if parameter number is a perfect number. Use this function in a program that determines and prints all the perfect numbers between 1 and 1000. Print the factors of each perfect number to confirm that the number is indeed perfect. Challenge the power of your computer by testing numbers much larger than 1000.
- The greatest integer function is defined by int(x) = the greatest integer that is ....................For example, int(2.5) = ................ int(-2.5) = ............... and int(0.5) = ...................Write a function PrintShampooInstructions(), with int parameter numCycles, and void return type. If numCycles is less than 1, print "Too few.". If more than 4, print "Too many.". Else, print "N: Lather and rinse." numCycles times, where N is the cycle number, followed by "Done.". End with a newline. Example output with input 2: 1: Lather and rinse.2: Lather and rinse.Done.Hint: Declare and use a loop variable. #include <iostream>using namespace std; /* Your solution goes here */ int main() {int userCycles; cin >> userCycles;PrintShampooInstructions(userCycles); return 0;} Please help me with this problem using c++.Write a function print_shampoo_instructions() with parameter num_cycles. If num_cycles is less than 1, print "Too few.". If more than 4, print "Too many.". Else, print "N : Lather and rinse." num_cycles times, where N is the cycle number, followed by "Done.".Sample output with input: 2 1 : Lather and rinse. 2 : Lather and rinse. Done. Hint: Define and use a loop variable. I have to define a "print_shampoo_instruction" function def shampoo_instructions(num_cycles): if num_cycles < 1: print('Too few.') elif num_cycles > 4: print('Too many.') else: i = 0 while i<num_cycles: print(i + 1,": Lather and rinse.") i = i + 1 print('Done.') def print_shampoo_instructions(num_cycles): print(shampoo_instructions(num_cycles)) return num_cycles ## this is my code user_cycles = int(input())#can not be alter in the programprint_shampoo_instructions(user_cycles)#can not be alter in the program
- Write a fruitful function sum_to(n) that returns the sum of all integer numbers up to and including n. So sum_to(10) would be 1+2+3...+10 which would return the value 55. Put your program in sum_numbers.pyWrite a function which solves a projectile problem. As input, the function will take the initial height (y0) from which the projectile is launched, the initial velocity, and the angle in degrees which the initial velocity makes with the horizontal (positive if above the horizontal, negative if below the horizontal). The function should calculate the time T the projectile stays in air, generate a time array (0, T/100, 2T/100, 3T/100, …, T), and return the values of x and y (the components of the position vector of the projectile) at the times in the array. Plot the projectile trajectory using matplotlib. Use phyton language pls put output screenshot import mathimport numpy as npimport matplotlib.pyplot as plt%matplotlib inlineWrite a function which solves a projectile problem. As input, the function will take the initial height (y0) from which the projectile is launched, the initial velocity, and the angle in degrees which the initial velocity makes with the horizontal (positive if above the horizontal, negative if below the horizontal). The function should calculate the time T the projectile stays in air, generate a time array (0, T/100, 2T/100, 3T/100, …, T), and return the values of x and y (the components of the position vector of the projectile) at the times in the array. Plot the projectile trajectory using matplotlib. Use phyton language