There are six items to be rung up in the cash register. The first item costs $15.00. Each item after that costs an additional $2.00. (item #2 costs $17, item #3 costs $19, etc.) 3. Create Python program code using a for loop that will print the cost of each item, starting with the $15 item, and it will calculate and print the total cost. Your program should then use the sequence formula as an alternative way to calculate the total cost and print the result.
Q: (Python) Which is the correct answer? This loop is best when you want the loop to run X amount of…
A: while: It is best way to use when the number of times the particular loop need to be iterate is not…
Q: Answer the ff looping problems- WHILE LOOP 1. Allow the user to input integer values and sum up…
A: The Jаvа while lоор is used tо iterаte а раrt оf the рrоgrаm reрeаtedly until the…
Q: Hi,please I need to use Python for the following: Use for loop to do the following: 1) print the…
A: Program instructions:Use range() in for loop to print the numbers.Function range() has here…
Q: In Python Write a program that will produce the following table below. You will use a nested FOR…
A: print("X",end=" ")for i in range(1,13): print(i,end=" ")for i in range(1,13): print() print(i,end="…
Q: I have a python programing question:- Write a program that inputs the miles driven and the gallons…
A: Following is the python program to calculate miles per gallon for each trip.Approach: Using while…
Q: Write a program using a for loop repitition statement that will print numbers 1,3 ,5 ,7 ,9,11 ,13…
A: Start Take the elements Find the sum of the elements Print the result Stop
Q: 1. Write a Python program to: ask the user to enter the price of an item. Note: use a while loop to…
A: Program Approach – Prompt user to enter the price and the quantity of items to be purchased. Use…
Q: Write Python code that prompts the user to enter an even integer and then uses a while loop that…
A: 1. While true 2. Try 3. Ask the user to enter a number and store it into even 4. If the even%2…
Q: Using two lists. numSet = [1,2,3] alphaSet = ['A', 'B', 'C'] Write a program that will iterate…
A: Program: numSet = [1,2,3] #list of number alphaSet = ['A', 'B', 'C'] #list of alphabets for num…
Q: In Python 3, construct a for loop that calculates the sum of all odd or all even numbers starting…
A: Program Approach – Prompt the user to enter the number ranging between 1 and 50. If the user…
Q: C++
A: Following is the C++ program that takes as input from user the value of x. Then using the while loop…
Q: Write a Python program that accepts three integer numbers (lo, hi, and fact) from the user. The…
A: #asking user to enter value of lo,hi,fact lo=int(input("Enter Value of lo : ")) hi=int(input("Enter…
Q: 2.c Write a Python program to input from the user the values of length, width, and height. The…
A: Program Approach: Define function named volume() with length ,width and height as parameters and…
Q: Given three inputs: a number to display its multiplication table a starting number for multiplying…
A: n = int(input())s = int(input())e = int(input()) print() for i in range(s, e+1):…
Q: Question 1 Write a python program using while loop to find the sum of the below given series up to…
A: #taking user input for nn = int(input('Enter value of n : '))i = 1.0 #initialize iS = 0.0…
Q: QI: Write a Python program that uses for/while loop to calculate the sum and average of every 10…
A: Q1. Python Code: def average_numbers(add,count): for i in range(100,501,10): add=add+i…
Q: In this lab the completed program should print the numbers 0 through 10, along with their values…
A: Step 1 : Start Step 2 : In the main method , Declare the variables numberCounter , byTen , byTwo.…
Q: Question 1: Write a python program using while loop to calculate the following series:…
A: Given: To write a python program to calculate the given series.
Q: Write a python program using for loop to read a number n and display the numbers from 3 to n which…
A: Coded using Python 3. We will be using for loop with a step index of 3 and the range is between 3…
Q: looking for a simple python script with an explanation of how -(for loops) work. provide code and…
A: print("Welcome to the Prime Number Checker\n") #this loop will run until user enter valid input…
Q: The input to your program are two integers start and stop. Check that the second integer stop is not…
A: Python code to print the particular output sequence is as given below.
Q: Using loops, write a program that reads 3 one-digit integer number (from 1 to 9, 0 is excluded) from…
A: Logic:- create a separate function to test whether it is one digit or not. Take first digit and…
Q: pi is equal to the following infinite sum: pi = 4 - 4/3 + 4/5 - 4/7 + 4/9 -.......... Write a…
A: Given that pi is equal to the following infinite sum: pi = 4 - 4/3 + 4/5 - 4/7 + 4/9 -..........…
Q: (B) Using visual basic6 programming language, write a program using Do ...Loop Until to counts from…
A: The question asks to form a "Do..Loop Until" where it shows to count from 1 to 10.
Q: ***python only*** What is output of the following program, if the user input are x=5 and y=11? def…
A: def main() : x = int(input('Enter value for x:')) y = int(input('Enter value for y:')) c…
Q: 5. Write a for loop that is equivalent to the following for loop int y = 10; while (y > 0) { y= y…
A: The given while loop prints numbers from 9 to 0. Equivalent for loop code using java is in Step 2.
Q: By using while loop OR do..while loop, write a program that displays a list of groceries. Then,…
A: Programming language is missing in the question. So we will answer this program in C++ language. If…
Q: Write a program that will print the message “I love computer science” 12 times. Use a while loop.…
A: #include <iostream> using namespace std; int main(){ int n=1; //initialize n to 1…
Q: Use a for loop to print out the values of each list item and its square separated by a tab in a new…
A: odds=[1,3,5,7,9] #declaring list for item in odds:…
Q: Write Python statements that use a for loop, make the variable x go from -10 to 10, counting by 2.…
A: Please find the answer below :
Q: In python-format please: With a while loop, calculate the sum of the first even numbers, starting…
A: PROGRAM INTRODUCTION: Declare and initialize the required variables. Use a while loop to calculate…
Q: 2 Write a python program that reads ten product prices using a for loop this program must calculate…
A: Below is the required python code. NOTE: If you want to run the program successfully, use the proper…
Q: Using for loop, write a Python program that: 1. Reads the number of hours worked by 10 employees. 2.…
A: PROGRAM INTRODUCTION: Declare and initialize the required variable. Use a loop to take 10 values…
Q: Write a while loop that prints from 1 to user_num, increasing by 1 each time.
A: START Declare i = 1 Input user_num While i less than equal to user_num Print i Increment i by 1…
Q: In python, create a while Loop Create a while loop that will print the John Wayne quote "Slap some…
A: Python used to answer this question
Q: Write a for loop (using the range() function) that will print the integers 10,15,20,25,30,…50 on one…
A: range() is a function which has three attributes. They are : start: The starting integer of the…
Q: Write some python code that uses a while loop to get 10 integers from the user, one at a time. When…
A: Start create empty list user has to input 10 number append number into list find max using max…
Q: a) Rewrite the following line using the while loop! for ( int x = 0; x <10; x + = 2) printf (“5”) ;…
A: Code: #include <stdio.h>#include <string.h>int main() { int x = 0; while(x<10)…
Q: Write a program that requests the current time and a waiting time as two integers for the number of…
A: Given that, Write a program that requests the current time and a waiting time as two integers for…
Q: python) Study the following code, specifically the loop. _sum = 10 for k in range (2, 20, 3):…
A: _sum = 10k=2while k<20 : _sum = _sum + (2*k) k=k+3 if _sum > 100:…
Q: C++ PROBLEM Write a loop to print all multiples of 3 from 20 down to 10 inclusive on a single line.…
A: A simple solution is to iterate over all the number in reverse order from high range to lower range…
Q: Write a Python program that will ask the user five (5) times using a WHILE Loop to input the full…
A: Using the while loop a set of statements can be executed for the true condition. Syntax: x = 1while…
Q: Example Output: Enter the number of rows: 8 1 1 1 1 2 1 13 3 1 14 6 4 1 15 10 10 5 1 16 15 20 15 6 1…
A: Program Description: To print the inverted Pascal Triangle using for loops. Algorithm: To print the…
Q: Write a program that uses loops structure to perform the following: 1. Prompt the user to input two…
A: The complete C++ code is below:
Q: For C Programming This has to deal with the Fibonacci sequence. Complete a program so that it…
A: #include<stdio.h> int fib(int n) // user defined fib…
Q: Write a Python program that will ask the user five (5) times using a WHILE Loop to input the full…
A: Your python program is given below with an output.
Q: Write a program that asks the user to enter the number of cars their family have. Then, your program…
A: This is a simple program of taking number of cars from user, say n. Then run a loop n times to take…
Q: Problem 2 Write a python program using for loop & while loop to calculate the series given below.…
A: Algorithm: Start Read x,y values Initialize sum=0 Using for loop calculate for j…
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- I can't figure this one out for the life of me. I've been stuck on it for 4 hours now... HELP! The programming language is python Write a program that prompts the user to enter a series of strings, but with each string containing a small integer. Use a while loop and stop the loop when the user enters a zero. When the loop has finished, the program should display: • the number of user inputs (not counting the final zero input). • the total of the integers in the strings entered. • the average of the integers accurate to one decimal place.In python, A customer in a store is purchasing items. Write a program, using a while loop, that asks for the price of each item, then displays the subtotal of the sale, the amount of sales tax, and the total when the customer is done entering all the items. Assume the sales tax is 7 percent. The customer should be allowed to enter as many items as they wish. The while loop should terminate when the user hit the key (Return) on the keyboard. (Hint: Use a null or empty string). Optionally, if you would like to round the dollar amount to two decimal places, you can use output formatting construct in your print statement. For example: print("Sales tax: ", format(sales_tax, '.2f')) will round to two decimal places. Expected Output: Enter the item price or <ENTER> to end: 22.50Enter the item price or <ENTER> to end: 1.99Enter the item price or <ENTER> to end: 45.30Enter the item price or <ENTER> to end: 70Enter the item price or <ENTER> to end: 5Enter the item…5. There are 10 bowlers on the team. Write a Python program that uses a for loop to input each of their scores. Your program should use a while loop to validate that each score entered is greater than zero and not greater than 300. Once the scores have been processed, the program should print the average bowling Score. Test your program by entering a score = 0, a score 300, a score = 300, and valid scores.
- in python for glass box testing of a while loop, you should test cases where: a) the while loop is not entered b) the body of the while loop is executed just once c) the body of the while loop is executed more than once e) all of these f) exiting the loop in the middle of the bodypython Write a program that runs like a cashier in a store. The program should use a while loop and prompt for the quantity and unit price of each item being purchased. The number of different items cannot be known in advance so the loop should continue until zero is entered for the quantity. A subtotal should be printed after each item's data has been rung up. See Sample Output. When the loop ends the program should report the number of different itemspurchased and the total amount due. SAMPLE OUTPUT: Enter item quantity or zero to quit 2 Enter unit price of item 2.50 Subtotal is $5.00 Enter item quantity or zero to quit 1 Enter unit price of item 7.99 Subtotal is $7.99 Enter item quantity or zero to quit 3 Enter unit price of item 2.39 Subtotal is $7.17 Enter item quantity or zero to quit 0 You purchased 3 different items Please pay $20.16The program should be written in python 1. first ask the user to enter the number of students in the range of 1 to 10. 2. then the program asks the user to enter the number of tests (in the range of 1 to 5) 3. Then use a loop to collect the scores for those many tests for each student. The outer loop will iterate once for each student. The inner loop will iterate several times, once for each test. Each iteration of the inner loop will ask the user to enter the score for a test of a student. 3. After all iterations, the program should calculates and display the total scores and average score for each student.
- The following program will display the days for a month of the year. The input to the program is the number of days and the day of the week on which the first day of the month falls. The following program uses for loops to draw a rectangle of desired size. // P43a.cpp - This program displays the days of a month // Day 0: Sunday, Day 1: Monday, Day 2: Tuesday // Day 3: Wednesday, Day 4: Thursday, Day 5: Friday // Day 6: Saturday #include #include using namespace std; int main() { } int n_days, start_day; cout > n_days; cout >start_day; cout << "Sun\tMon\tTue\tWed\tThr\tFri\tSat\n"; for(int i = 0; i < start_day; i++) { cout << "\t": } for(int j = 1; j <= n_days; j++) { if(j%7 == 0) cout << endl; cout <MEANT TO BE IN PYTHON You can convert Fahrenhiet to Celcius using the formula below C=(F-32)*(0.55) Write a program with for loop which considers the Fahrenheit temperatures which are multiple of 5 between 50 and 100 and convert them into Celcius degree and print the Fahrenheit and Celcius degrees together with their headings Please show code.Harlan A. Brothers and John A. Knox discovered that as the value of x gets larger, the value of the expression gets closer and closer to e. Write a program that evaluates this expression for x = 1, 2, 3, and so on until the absolute difference between the expression’s value and the value of e calculated by the library function (exp) is less than 0.000001. Display the value of x that causes your loop to exit along with both the final approximation of e and the value of e calculated by the (exp) function. Show seven decimal places. IN C PROGRAMMING LANGUAGE PLEASE AND COMMENT EVERY STEP OF ITWrite a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program should first ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterate twelve times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for that month. After alliterations, the program should display the number of months, the total inches of rainfall, and the average rainfall per month for the entire period.Program - Python Write a program asking the user to keep entering in strings (ie names) until they enter the string “leave”, at which point you’ll exit the loop and tell them how many times they entered the string “gold”. This one requires that you use a loop and also keep a tally of the number of times they enter the string gold.PYTHON PROGRAMMING ONLY. Please provide explanation as well. Thank you. Write a while loop that lets a user enter a number less than 10. If the number inputted exceeds 10, print an error and ask for the number again, in which a user may enter the same or a different number. When the user inputs a valid number, the number should be incremented by 5, and the result assigned to a variable named sum. This loop should continue to iterate as long as the sum totals less than 50. When sum exceeds 30, it should print "Almost there..." until it reaches or exceeds 50. Once it does, print out "your final sum is (replace with final sum)". For example, if the sum is currently 45 and the user inputs 4, the program will not enter the loop again since the new sum will be 54 and should then print "your final sum is 45".SEE MORE QUESTIONS