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
Q: Write a program whose input is a character and a string, and whose output indicates the number of…
A: Here I have asked the user for character and the string and stored them into separate variables.…
Q: Write a program that prompts the user to input any digit then swap the position of the first and the…
A: #include <iostream>#include <string.h>using namespace std; int main(){ string number;…
Q: 8. Write a program that takes the lengths of the three sides of a triangle from the user and checks…
A: Need to write a program to check whether provided length of three sides of the triangle will form…
Q: What is the output of the following code: int x=4; int y=2; while(x<16) { } y=2*(x+1); X=X+1; if…
A: Let's find the value of y x [x+1] y [2*(x+1)] condition(x<16) 4 2 T 5 10 T 6 12 T…
Q: Write a program that takes in a line of text as input, and outputs that line of text in reverse. The…
A: The answer is
Q: Write a program that prompts the user to enter two positive integers less than 1,000,000,000 and the…
A: Program code: //include the required header files #include <iostream> using namespace std;…
Q: You are to write a program to tell you how many months it will take to pay off a loan, as well as…
A: Following is the code for the loan calculator using C++
Q: Write a program that will read a number from the keyboard. If 60≤number≤100 , display “Pass”, if…
A: Conditional Statement in C: Conditional statements in C execute sequentially based on the some…
Q: 2. Write a complete program that prompts the user for a test score and prints out the letter score…
A: Here I written Java code for given problem. I hope you like it.
Q: Write a program that takes in a line of text as input, and outputs that line of text in reverse. The…
A: phyton code described below
Q: From the following, what is the output? int num = 5; while (num > -5) { num -= 5;…
A: Correct option: A
Q: You have already been shown how to convert from base 10 to any base between 2 and 9 in class. Your…
A: We can use for loop and traverse over the base 2 number in the string format and parallelly multiply…
Q: Code-tracing What is the output of the following? Write your answer for each print statement. X 3 y…
A: % is mod operator that prints remainder.
Q: Write a program that reads any 5 numbers as in the given sample of output below: Sample of…
A: Required: Write a program that reads any 5 numbers as in the given sample of output below:
Q: Write a program whose inputs are three integers, and whose output is the largest of the three…
A:
Q: Develop a program that 1- Would read an input from the keyboard. The input should be a whole…
A: while True: #1- Would read an input from the keyboard. The input should be a whole positive…
Q: Write a program whose input is a character and a string, and whose output indicates the number of…
A: - We need to code the relation. We have to use java here.
Q: Write a program that does the following. Ask the user to enter 10 positive integer values from the…
A: Program Approach: Including the necessary header file. Defining the main method. Deffining an…
Q: a program which repeatedly reads positive numbers until the user enters -1. Once -1 is entered,…
A: It is defined as a powerful general-purpose programming language. It can be used to develop software…
Q: Write a program that accepts a number corresponding to a plane figure: 1. Right Triangle 2.…
A: import math choice = int(input("1. Right Triangle \n2. Rectangle \n3. Circle\n")) if choice == 1:…
Q: Write a program to read a positive integer value less than 100 that represents the number of cents,…
A: #include <iostream> using namespace std; int main(){ int amt,quaters,dimes,nickels,pennies;…
Q: 1)Write program to make simple calculator? The program input two number and one character? a) print…
A: As programming language is not mentioned i am providing you the answer in C++.
Q: Write a program that prompts the user to enter an integer and determines it is divisIble by and 6,…
A: Q1: #include<bits/stdc++.h> using namespace std; int main() { cout<<"Enter a…
Q: What will be the output of each of the following? x <- 1 y <- 1L is.integer(x) is.integer(y)…
A: In the given code : The value assigned to x is 1 which is an integer. The value assigned to y is 1L…
Q: Consider the code below. What is the output for x = 69? if x 10: print('Greater than 10') elif x >…
A: Consider the code below. What is the output for x = 69 ? if x < 10 print("Less than 10') elif x…
Q: Write a program that takes in a line of text as input, and outputs that line of text in reverse. The…
A: Below i have given program:
Q: Write a program whose inputs are three integers, and whose output is the smallest of the three…
A: Since the coding language is not mentioned, I have done the code in C++. Algorithm : Step 1 :…
Q: Write a program which prompts the user for a number and prints the numbers from 1 up to that number,…
A: ALGORITHM:- 1. Take the value of n as input from user. 2. Generate the numbers from 1 to the input…
Q: I'm stuck on this one: Write a program that takes in a line of text as input, and outputs that line…
A: The answer is..
Q: Write a program in Python that takes in a line of text as input, and outputs that line of text in…
A: def reverse(s): newString = "" for c in s: newString = c + newString return…
Q: 2. Write a complete program that prompts the user for a test score and prints out the letter score…
A: import java.util.Scanner;public class Main{ public static void main(String[] args) { Scanner sc…
Q: how to write a program that continuously takes grades between 0 and 100 to standard input until you…
A: PROGRAM INTRODUCTION: Declare and initialize the required variables. Use a while loop that contains…
Q: Write a program that takes an integer num between 1 and 99999, then computes the number of digits in…
A: The integer entered by the user is stored in variable n. Then the while loop is iterated until the…
Q: Write a program which takes an input from the user, if the input is 1, calculate the area of the…
A: Since you have not mentioned the programming language. I will attempt it in python. if you need this…
Q: Write a program that prompts the user to enter 10 inputs, each containing a number showing the…
A: Dear Student, As no language is mentioned I am assuming it to be python , program code is given…
Q: Exercise • Write a program that asks the user -Do you want to use this program? (y/n) • If the user…
A: Code: #include <iostream> using namespace std; int main(){ string c="y"; int count=1;…
Q: Write a program that reads multiple blood sugar rates for a patient for multiple visits to a…
A: #include <bits/stdc++.h>using namespace std; int main(){ vector<float> sugar_rate;…
Q: Write a program that prompts the user to enter an integer from 1 to 7 and displays a pyramid, as…
A: Please find the answer below :
Q: Write a program whose input is two integers. Output the first integer and subsequent increments of 5…
A: Please Indent the code as shown in the picture below :
Q: Write a python program that does temperature converter :\n", "- The user will enter if he wants the…
A: I give the code in Python along with output and code screenshot
Q: Write a program to input degree of student, if the degree is more than or equal to 90 the output is…
A: According to the asked question, the solution is given below with a proper explanation.
Q: Write a program that takes in a line of text as input, and outputs that line of text in reverse. The…
A: Code in java is below- import java.util.Scanner; // importing the util package public class…
Q: Write a program with total change amount as an integer input, and output the change using the fewest…
A: def main(): # get change amount as input from user change = int(input("Please enter amount due "))…
Q: 2. Write a complete program that prompts the user for a test score and prints out the letter score…
A: //2import java.util.Scanner;//to reading input from userpublic class Main{ public static void…
Q: In your chosen language, write a program that reads from stdin, and then writes that entire input to…
A: Since you are not mentioning the programming language, here we are using C++ to complete the…
Q: Write the output for the program given below if i = 0 and sum = 0. What will be the final value for…
A: do...while loop: The do...while loop is used to repeat a set of code statements repeatedly until a…
Q: Write a program with total change amount in pennies as an integer input, and output the change using…
A: def exact_change(user_total): user_total = int(input('Enter change: ')) if user_total <= 0:…
Q: In Python, Write a program that takes in a line of text as input, and outputs that line of text in…
A: EXPLANATION: - An empty list named str_list is created to store the string the user enters. The…
Q: Write a program that will prompt the user for a lengh in inches and convert the input into a…
A: The program first ask user to enter number of inches. It then convert inches in feet and inches…
I'm stuck on this one:
Write a
Ex: If the input is:
Hello there Hey done
then the output is:
ereht olleH yeH
Here is my code, but I'm not getting the right output. Thank you!
line_text = input()
while line_text != 'Done' and line_text != 'done' and line_text != 'd':
print(line_text[::-1])
line_text = input()
while line_text == 'Done' or line_text == 'done' or line_text == 'd':
print('done')
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
- Write a program that accepts a number corresponding to a plane figure: Right Triangle Rectangle Circle The program will then ask for the following: base and height – if the previous input is 1 (right triangle) width and length – if the previous input is 2 (rectangle) radius – if the previous input is 3 (circle)SPECIFICATIONS: - The program will then display the perimeter (circumference of the circle) and area of the chosen figure. You’re free to format the input/output display. The numeric output should be computed and NOT HARD-CODED. - The program will display “invalid input” if the initial input is not 1,2 or 3. After this, the program will terminate.- The next input (dimension/s of the chosen figure) will be stored on a float data type. The program will automatically terminate if the input is not a number.- Observe proper code indention - All lines should have a comment- Save your cpp file as Surname - PE (Example: Pangaliman - PE.cpp)TEST CASES: If the user inputs…Write a program that reads from the user a character ('q' or 'c'). If the character is 'c', the program reads from the user the radius rof a circle and prints its area. • If the user enters 'q', the program asks the user to enter the length and width of a quadrilateral. We assume the quadrilateral is either a square or rectangle. You should print if the quadrilateral is square or rectangle. • Otherwise, it prints "Wrong character" PS: Use the following formulas: area of circle=3.14*r Sample Run1: Enter a character (q or c): q Enter the Length and Width: 80 150 |It is a rectangle Sample Run2: Enter a character (q or c): q Enter the Length and Width: 80 80 It is a square Sample Run3: Enter a character (q or c): c Enter the radius: 2 The area of the circle is 12.56 Sample Run4: Enter a character (q or c): d Wrong characterAirline companies apply baggage restrictions for their passengers. An airline company has decided to apply a 10kg limitation for passengers' hand luggage and 20kg for their normal baggage. When passengers arrive, they enter their hand and normal luggage weight from the keyboard. If passengers exceed their normal baggage allowance of 10 dollars per gram, they pay 12 dollars per kg. Accordingly, write the program that calculates the baggage price of the airline they will go to according to the baggage values entered by the arriving passenger and keeps this from closing the program for each passenger. Note: If hand and normal baggage allowances are stretched below the maximum value, the payment amount will be considered not negative. An example printout is given on the right. Geri bildirim gönder
- Write a program that reads from the user a character (*q' or 'c'). If the character is 'c', the program reads from the user the radius r of a circle and prints its area. If the user enters 'q', the program asks the user to enter the length and width of a quadrilateral. We assume the quadrilateral is either a square or rectangle. You should print if the quadrilateral is square or rectangle. Otherwise, it prints "Wrong character" PS: Use the following formulas : area of circle=3.14*r? ISometimes we write similar letters to different people. For example, you might write to your parents to tell them about your classes and your friends and to ask for money; you might write to a friend about your love life, your classes, and your hobbies; and you might write to your brother about your hobbies and your friends and to ask for money. Write a program that prints similar letters such as these to three people of your choice. Each letter should have at least one paragraph in common with each of the other letters. Your main program should have three method calls, one for each of the people to whom you are writing. Try to isolate repeated tasks into methods.Coral Help Write a program that takes a date as input and outputs the date's season. The input is an integer to represent the month and an integer to represent the day. Ex: If the input is: 4 11 the output is: spring In addition, check if both integers are valid (an actual month and day). Ex: If the input is: 14 65 the output is: invalid The dates for each season are:spring: March 20 - June 20summer: June 21 - September 21autumn: September 22 - December 20winter: December 21 - March 19
- You arrive in front of a bridge that you must cross to reach a village before dark. Crossing the bridge is not free - the bridgekeeper asks you to roll two dice to determine the cost. You decide to write a program to verify that he is charging the right price. Your program should read two integers, between 1 and 6, representing the values of each die. If the sum is greater than or equal to 10, then you must pay a special fee (36 coins). Otherwise, you pay twice the sum of the values of the two dice. Your program must then display the text "Special tax" or "Regular tax" followed by the amount you have to pay on the next line.Write a program that generates a plate number based on the user's answer to the following questions: 1. What is your favorite color of the rainbow (ROYGVIB)? a. Use the first letter of the chosen color as the first character of the plate number. b. Display "Invalid Input" and ask the user to re-enter his/her answer if the answer is not a valid color of the rainbow. 2. What is your month of birth? a. Use the last letter of the month as the second character of the plate number. b. Display "Invalid Input" and ask the user to re-enter his/her answer if the answer is not a valid month. 3. What is your first name? a. Use the third letter of the first name as the third character of the plate number. No need to include the second name if you have a second name. Make sure to use "cout" and "cin" to collect the necessary inputs from the user. For the number section: 1. Ask the user his/her age and use the age as the first and second digits of the plate number. a. Display "Invalid Input" and ask…Please write a program which prints out the following story. The user gives a name and a year, which should be inserted into the printout. Please type in a name: Mary Please type in a year: 1572 Mary is a valiant knight, born in the year 1572. One morning Mary woke up to an awful racket: a dragon was approaching the village. Only Mary could save the village's residents. The story should change according to the input given by the user. Sample output 1
- 3. Having a secure password is a very important practice, when much of our information is stored online. Write a program that validates a new password, following these rules: The password must be at least 8 characters long. The password must have at least one uppercase and one lowercase letter. The password must have at least one digit. Write a program that asks for a password, then asks again to confirm it. If the passwords don't match or the rules are not fulfilled, prompt again. Your program should include a function that checks whether a password is valid.. Write a program that generates and prints 50 random integers, each between 3 and 6. .Write a program that generates a random number, x, between 1 and 50, a random number y between 2 and 5, and computes x". .Write a program that generates a random number between 1 and 10 and prints your name that many times. .Write a program that generates a random decimal number between 1 and 10 with two decimal places of accuracy. Examples are 1.23, 3.45, 9.80, and 5.00.A parking garage charges a $2.00 minimum fee to park for up to three hours. The garage charges an additional $0.50 per hour for each hour or part thereof in excess of three hours. The maximum charge for any given 24-hour period is $10.00. Assume that no car parks for longer than 24 hours at a time. Write a program that calculates and prints the parking charges for each of three customers who parked their cars in this garage yesterday. You should enter the hours parked for each customer. Your program should print the results in a neat tabular format and should calculate and print the total of yesterday’s receipts. The program should use the function calculateCharges to determine the charge for each customer. Your outputs should appear in the following format Sample output Enter the hours parked for 3 cars: 1.5 4.0 24.0 Car Hours Charge 1 1.5 2.00 2 4.0 2.50 3 24.0 10.00 TOTAL 29.5 14.50