
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Write a python program using a while or for loop 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.
![input()
2 greeting
3 greetings list = ['Hello there', 'Hey']
%3!
4
5
6 while greeting != 'Done' or 'done' or 'd':
for greeting in reversed (greeting):
print(greeting[::-1], end = ')
7
8
9](https://content.bartleby.com/qna-images/question/2bc2a3ad-b0fb-46d0-8be8-5188cce94b42/b88bcae9-f368-468b-9011-8aa37b4a2804/hrs1z5_thumbnail.jpeg)
Transcribed Image Text:input()
2 greeting
3 greetings list = ['Hello there', 'Hey']
%3!
4
5
6 while greeting != 'Done' or 'done' or 'd':
for greeting in reversed (greeting):
print(greeting[::-1], end = ')
7
8
9
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Please write a python program that follows the following criteria: Write a program that asks the user to enter the amount that he or she has budgeted for a month. A loop should then prompt the user to enter each of his or her expenses for the month and keep a running total. When the loop finishes, the program should display the amount that the user is over or under budget. Thanks so much for your help!arrow_forwardPlease help me with this question in python using psedocode details. I have attached both pictures below:-arrow_forwardIn python, Write a for loop that iterates through numbers from 1 to 10, adds them up together, and prints the total. The printed output should be 55.arrow_forward
- Write a Python code This lab requires you to write a complete program using a condition controlled loop, a counter controlled loop, and an accumulator. The program is as follows: Write a program that will allow a grocery store to keep track of the total number of bottles collected for seven days. The program will calculate the total number of bottles returned for the week and the amount paid out (the total returned times .10 cents). The output of the program should include the total number of bottles returned and the total paid out. The program will ask the user if they have more data to enter and will end the program if they do not. Step 1: In the pseudocode below, declare the following variables under the documentation for Step 1. A variable called totalBottles that is initialized to 0 This variable will store the accumulated bottle values A variable called counter and that is initialized to 1 This variable will control the loop A variable called todayBottles…arrow_forwardComputer Science The script below demonstrates a very basic loop structure. Indicate the value of R1 after 5 iterations of the loop. (Given the very first line of code, you can assume R1 starts out as 0x00)arrow_forwardUsing Pythonarrow_forward
- Write a python program that uses while loops to display the number of bugs collected throughout 5 days. In addition to displaying the total number of bugs collected, display the average number of bugs collected per day. The average should be displayed with 1 digit to the right of the decimal.arrow_forwardpython question Implement the following:1) Use a loop to continuously request an integer input from the console.2) As long as the value is in the range from -10 to 10 inclusive, request new values.3) Once the value is not in the range above, end the loop.4) Prompt a message and print the sum of all valid values.Input text can be any content. Just make sure to precisely match the output format below.Write your code in the ANSWER area provided below (must include comments if using code is not covered in the course).Example OutputEnter a number (-10, 10): 0Enter a number (-10, 10): 1Enter a number (-10, 10): -1Enter a number (-10, 10): 11Number out of range entered. Loop terminates.0arrow_forwardPython programming A country club, which currently charges $3500 per year for membership, has announced it will increase its membership fee by 5.5% every other yearfor the next 20 years. Write a Python program segment that uses a for loop to calculate and print the projected rates for the next 20 years.arrow_forward
- Write a Python program that computes and displays the sum of five numbers entered by the user. For example, when running the above program, if the user enters: 3, 4, 5, 2, 1, then the program should display the sum = 15 (hint: make use of a for loop and accumulating the sum in a variable)arrow_forwardWrite a python program that determines the length of a user inputted string. Note: This program should NOT use the len() function Sample output: Enter a word: capybara The length of capybara is 8 This problem will help you practice using for loops. Remember the for and in keywords.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education