A pedometer treats walking 2,000 steps as walking 1 mile. Write a program whose input is the number of steps, and whose output is the miles walked. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: print('{:.2f}'.format(your_value)) Ex: If the input is: 5345 the output is: 2.67 Your program must define and call the following function. The function should return the amount of miles walked. def steps_to_miles(user_steps)
Q: For reproducibility needed for auto-grading, seed the program with a value of 2. In a real program,…
A: The seed value is generally declare while creating instance of Random Numbers
Q: Python 3.7.4: I'm wasting a second request for the same question because the person who answered the…
A: This question asks about to check year is Leap year or not. So, let's know about Leap Year : Leap…
Q: Problem 2 A number in base 2 (binary) is a number such that each of its digits is 0 or 1. To convert…
A: Here I have taken input from the user. Next, I have taken a while loop, and inside the loop, I have…
Q: 3. Use a trace table to show what is the output of the following program? #include using namespace…
A: As per the policy we are required to answer only one question.Solution for question 3 is as…
Q: integers, and whose output is the first integer and subsequent increments of 5 as long as the value…
A: First we need to check if first integer is greater than second or not and then print the values if…
Q: Examine the following code segment. What will be printed? If there are any errors indicate the…
A: Errors in program: Variable “i” which is used for loop traversing is not declared. This error is…
Q: 18. Write a program that will display the following pattern, given the Example: If n =5, output…
A: C code to print given pattern is as below.
Q: 2B. Given x=3 and y=6, what is the value of z after the expression z=x*y==18 is executed?
A: Note: There are multiple questions are given in one question. According to the rule, you will get…
Q: 4. a. Please translate with a three-address statement, the following expression: n = f((x+2), y) –…
A: The three-address statements is a method to solve expressions in a way that is easier for the…
Q: 4. Write a function to compute the following: i.e. the area and perimeter circle as given below. No…
A: import math #to use value of pidef areaperi(r): area = math.pi*r*r perimeter = 2*math.pi*r…
Q: 13) What does the following code do? int value1 = Keyboard.readInt( ); int value2 =…
A: Question 13. What does the following code do? int value1 = Keyboard.readInt( ); int value2 =…
Q: Write a program that removes all non-alpha characters from the given input. Ex: If the input is:…
A: Step 1 The code is given in the below step;
Q: The output of this program is:(6,8,5) #include using namespace std;void add (int a,int b){int…
A: The function add is multiplying the parameter values and printing its value and this will be the…
Q: Problem 2 A number in base 2 (binary) is a number such that each of its digits is 0 or 1. To convert…
A: Introduction :
Q: Python 3.7.4: Assume that C is a variable has been assigned a string value. Write an expression…
A: Since you have not specified what needs to be done in else part so we have included a print…
Q: #include using namespace std; int g = 100; int main() { int a; { int b; b = 20; a = 35; g…
A: Given, C++ code: #include <iostream> using namespace std; int g = 100; int main() { int…
Q: 4. Write pseudo code that will perform the following. a) Read in 5 separate numbers and calculate…
A: Required:
Q: 4.18 LAB: Input and formatted output: House real estate summary Sites like Zillow get input about…
A: current_price=int(input())last_month_price=int(input())mortgage = (current_price *…
Q: Write a program with total change amount as an integer input that outputs the change using the…
A: [Note: please use proper indentation to avoid erros. snapshots of program code are provided in step…
Q: 49- Find the output of the following program. * main(){ int a = 10, b, c; b = a++; C = a; cout << a…
A: The given code is - main(){ int a = 10, b, c; b = a++; c = a; cout << a << "…
Q: 8. a. Trace Thru the following code. Simply display the output. What is the output of the following…
A: Let's understand what this code will do . We have one list 1,2,3,4,5,6 Next we have the for loop…
Q: 49- Find the output of the following program. main(){ int a 10, b, с; = a++; C = a; cout << a <« “ «…
A: int a=10,b,c; means a=10 and a=b means b=10 and a=c means c=10
Q: 3. Trace the given code and write the output. #include using namespace std; int main() int resp…
A: The above code output and explanation is given in step 2:-
Q: 2B. Given x=3 and y=6, what is the value of z after the expression z=x*y=%=18 is executed?
A: Note: There are multiple questions are given in one question. According to the rule, you will get…
Q: 2.15 LAB: Using math functions Given three floating-point numbers x, y, and z, output x to the power…
A: Given:
Q: 6.12) Since communications channels are often noisy, numerous ways have been devised to ensure…
A: the code is given below in c
Q: Q.5/ Write a program to enter two numbers and compute multiplication and division operations using…
A: Dim x, y, z As Single ' Description: Compute Multiplication & Division operationPrivate Sub…
Q: 7-The final result of the following statements is u = [0 0 1 1 0 1]; v = [011001]; u|v
A: Answer in step 2
Q: Write a program that converts the angle from degree to radian and displays each value.
A: "Since you have asked multiple question,we will solve the first question for you.If you want any…
Q: Python 3.7.4 The current calendar, called the Gregorian calendar, was introduced in 1582. Every year…
A: The following is the source code which takes the input from the user and tells whether the input…
Q: Q1) Write a program to add 3 numbers ( 2 bytes each), The 1" one is stored in memory locations…
A: Write a program to add 3 numbers two bytes each.
Q: In Python please:
A: Approach Take the input from a user representing a number of miles of type float and stored it in…
Q: 9. Write a program that computes the fuel efficiency of a multi-leg journey. The program will first…
A: First prompt for the starting odometer reading and then get information about a series of legs.…
Q: Write a program that takes in a line of text as input, and outputs that line of text in reverse. The…
A: Remember, indentation is an important factor in python. So we have to maintain that. Code:…
Q: 7. Let the statements A, B be given by A: not(p or q), B: (not p) or q. Let T= true, F = false. If p…
A: Given , A: not( p or q ) ; p = T ; q = F . i.e A = not ( T or F ) A = not ( T ) A = F
Q: 7.18 LAB: A jiffy A jiffy" is the scientific name for 1/100th of a second. Define a function named…
A: Algorithm: 1. Take Input. 2. Read the function and return userJiffies/100. 3. Display Output to 3…
Q: Q6: Write a program to find and print the value of (f) from the following equations for Fourteen…
A: Since the values aren't given with the question, we write the program to find f for any values of…
Q: 2.15 LAB: Using math functions Given three floating-point numbers x, y, and z, output x to the power…
A: NOTE - As per the guidelines we can only answer one question in multi questions, so please repost…
Q: 2.17 LAB: Convert from seconds People find it easier to read time in hours, minutes, and seconds…
A: Introduction: In a single hour, there are 3,600 seconds. Divide the total number of seconds by 3,600…
Q: 6. Create a program that will convert: 6.1 Degree Fahrenheit to degree celsius and vice versa.
A: Since you have asked multiple questions we will answer the first one only. If you want any specific…
Q: 7.14 LAB: Remove all non-alpha characters Write a program that removes all non-alpha characters from…
A: Please find the answer below :
Q: 3) Write a pseudocode that will perform the following: - Read in 5 separate numbers. - Calculate the…
A: here in this question we have asked to write a pseudocode that take five input from user and…
Q: Python 3.7.4: Write a loop that reads positive integers from standard input and that terminates when…
A: Following is the program code that takes input from the user all positive integer and terminates if…
Q: 14- The following script is used to find the series (g = 1+ e-x+2e-2x + 3e-3x + + 10e-10x) *…
A: The answer is false, because the above mentioned code generates the following error.
Q: Write a program with total change amount as an integer input, and output the change using the fewest…
A: CODE:- amount = int(input("Enter Amount: "))if amount<=0: print("No Change") else:…
Q: 3.13 LAB: Exact change Write a program with total change amount as an integer input, and output the…
A: coded in python to get the above output of exact changes (Python Language)
Q: 14- The following script is used to find the series (g = 1+ e-x+2e-2x + 3e-3x + ..• + 10e-10x) *…
A: Task : The task is to check whether the given code implements that series whose value is equal to…
Q: Write a program that takes any number of integers as input, and outputs the average and max.
A: Step by step explanation Input any number of integers separated by space using input().split()…
Q: 24. What will the following code print out def func(x): print (x) func (10) func (20) b. func 10 d.…
A: Python is a very famous programming language these days, It is an Object oriented programming,…
Q: Problem 2 A number in base 2 (binary) is a number such that each of its digits is 0 or 1. To convert…
A: Introduction :
5.20 LAB: Step counter
A pedometer treats walking 2,000 steps as walking 1 mile. Write a program whose input is the number of steps, and whose output is the miles walked.
Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
print('{:.2f}'.format(your_value))
Ex: If the input is:
5345the output is:
2.67Your program must define and call the following function. The function should return the amount of miles walked.
def steps_to_miles(user_steps)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- 5.23 In Python: Write a program with total change amount as an integer input that outputs the change using the fewest coins, one coin type per line. The coin types are dollars, quarters, dimes, nickels, and pennies. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies. Ex: If the input is: 0 or less, the output is: no change Ex: If the input is: 45 the output is: 1 quarter 2 dimes Your program must define and call the following function. The function exact_change() should return num_dollars, num_quarters, num_dimes, num_nickels, and num_pennies.def exact_change(user_total)4.19 C++ Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Done", "done", or "d" for the line of text. Ex: If the input is: Hello there Hey done then the output is: ereht olleH yeH3.27 LAB: Login name Write a program that creates a login name for a user, given the user's first name, last name, and a four-digit integer as input. Output the login name, which is made up of the first six letters of the first name, followed by the first letter of the last name, an underscore (_), and then the last digit of the number (use the % operator). If the first name has less than six letters, then use all letters of the first name. Ex: If the input is: Michael Jordan 1991 the output is: Your login name: MichaeJ_1 Ex: If the input is: Nicole Smith 2024 the output is: Your login name: NicoleS_4
- 4.18 C++ Write a program whose input is two integers, and whose output is the first integer and subsequent increments of 5 as long as the value is less than or equal to the second integer. End with a newline. Ex: If the input is: -15 10 the output is: -15 -10 -5 0 5 10 Ex: If the second integer is less than the first as in: 20 5 the output is: Second integer can't be less than the first. For coding simplicity, output a space after every integer, including the last.4.18 C++ Write a program whose input is two integers, and whose output is the first integer and subsequent increments of 5 as long as the value is less than or equal to the second integer. End with a newline. Ex: If the input is: -15 10 the output is: -15 -10 -5 0 5 10 Ex: If the second integer is less than the first as in: 20 5 the output is: Second integer can't be less than the first.Python 3.7.4: The current calendar, called the Gregorian calendar, was introduced in 1582. Every year divisible by four was created to be a leap year, with the exception of the years ending in 00 (that is, those divisible by 100) and not divisible by 400. For instance, the years 1600 and 2000 are leap years, but 1700, 1800, and 1900 are not. Write a program that requests a year as input and states whether it is a leap year. We need to run this as many times as the user wants to check for leap years. --------------------------- Below is my original program. I need to change it so that it now has a main() function plus three more functions. Do I convert the while loop to an if loop? The instructor said that it was a bad habit to include "break" in loops, so I was able to eliminate that. I just don't know how I can get that many functions out of this program. ''' Determine if a given year is a leap year, running as many times as the user wants to check for leap years''' #…
- Python 3.7.4: The current calendar, called the Gregorian calendar, was introduced in 1582. Every year divisible by four was created to be a leap year, with the exception of the years ending in 00 (that is, those divisible by 100) and not divisible by 400. For instance, the years 1600 and 2000 are leap years, but 1700, 1800, and 1900 are not. Write a program that requests a year as input and states whether it is a leap year. Below was marked incorrect for me. I need to put it in a while loop. Also, I'm curious if there is a way to do it without def? Thank you! ---------------------- def leap(year): if(year % 400 == 0): return True elif year % 100 == 0: return False elif year%4 == 0: return True else: return False def main(): year = int(input("Enter year: ")) if(leap(year)): print(year,"is a leap year") else: print(year, "is not a leap year") -----------------------C++ 10.19 Given a line of text as input, output the number of characters excluding spaces, periods, exclamation points, or commas. Ex: If the input is: Listen, Mr. Jones, calm down. the output is: 21 Note: Account for all characters that aren't spaces, periods, exclamation points, or commas (Ex: "r", "2", "?"). code provided: #include <iostream>#include <string>using namespace std; int main() { string userText; // Add more variables as needed getline(cin, userText); // Gets entire line, including spaces. /* Type your code here. */ return 0;}5.12.2: Switch statement to convert letters to Greek letters. Write a switch statement that checks origLetter. If 'a' or 'A', print "Alpha". If 'b' or 'B', print "Beta". For any other character, print "Unknown". Use fall-through as appropriate. End with newline. import java.util.Scanner; public class ConvertToGreek {public static void main (String [] args) {Scanner scnr = new Scanner(System.in);char origLetter; origLetter = scnr.next().charAt(0); /* Your solution goes here */ }}
- Python 3.7.4: Assume that C is a variable has been assigned a string value. Write an expression whose value is true if and only if C is what is called a whitespace character. (that is a space or a tab or a newline-- none of which result in ink being printed on paper) When I attempted it myself, MyProgrammingLab said that I "almost certainly should be using or."19.12 LAB: Convert from seconds People find it easier to read time in seconds, minutes, and hours rather than just seconds. Write a program that reads in seconds as input, and outputs the time in seconds, minutes, and hours. Ex: If the input is: 4000 the output is: Seconds: 40 Minutes: 6 Hours: 1 #include <iostream>using namespace std; int main() { int seconds; int minutes; int hours; /* Type your code here. */ return 0;}9.16 LAB: Flip a coin Write a program that simulates flipping a coin to make decisions. The input is how many decisions are needed, and the output is either heads or tails. Assume the input is a value greater than 0. Ex: If the input is: 3 the output is: tails heads tails For reproducibility needed for auto-grading, seed the program with a value of 2. In a real program, you would seed with the current time. In that case, every program's output would be different, which is what is desired but can't be auto-graded. Note: A common student mistake is to create an instance of Random before each call to rand.nextInt(). But seeding should only be done once, at the start of the program, after which rand.nextInt() can be called any number of times. Your program must define and call the following method that randomly picks 0 or 1 and returns "heads" or "tails". Assume the value 0 represents "heads" and 1 represents "tails".public static String headsOrTails(Random rand) import…