Question

3). Repetition Structure: Note: this question is based on question 2), feel free to add the loops directly into the code for
-- another tour after labeling a tour; if the user answers yes, the program should again prompt the user to enter the numbe
0 0
Add a comment Improve this question Transcribed image text
Answer #1
i=0
while(i!=1):
    f=1
    d=int(input("Enter the number of destinatios: "))
    if(d<1):
        print("Please enter a positive number of destinatios.")
        f=0
    if(d>=1 and f!=0):
        p=int(input("Enter the price for the tour: "))
        if(p>=500):
            print("The lable of this tour is Expensive")
        if(p<500 and p>=400):
            print("The lable of this tour is Good")
        if(p<400 and p>=300):
            print("The lable of this tour is Average")
        s=input("Do you want to check another tour? Enter yes if you do: ")
        ss=s.lower()
        if(ss=='yes'):
            i=0
        else:
            i=1
    

Enter the number of destinatios: 3 Enter the price for the tour: 500 The lable of this tour is Expensive Do you want to check

Add a comment
Know the answer?
Add Answer to:
3). Repetition Structure: Note: this question is based on question 2), feel free to add the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • two part question - answered in Python 3 2). Decision Structure: A travel agency is checking...

    two part question - answered in Python 3 2). Decision Structure: A travel agency is checking whether its tours are good for customers. It follows the table below to label each tour. (e.g., if a tour has 6 destinations and its price is $600, then it should be labelled as ‘expensive’.) Number of Destinations Price Label <5 <300 or >=300 good or expensive >=5 <500 or >=500 Good or Expensive Write a program that asks the user to enter the...

  • In C language using printf and scanf statements: Write a program to display a histogram based...

    In C language using printf and scanf statements: Write a program to display a histogram based on a number entered by the user. A histogram is a graphical representation of a number (in our case, using the asterisk character). On the same line after displaying the histogram, display the number. The entire program will repeat until the user enters zero or a negative number. Before the program ends, display "Bye...". The program will ask the user to enter a non-zero...

  • I am having trouble figuring out what should go in the place of "number" to make...

    I am having trouble figuring out what should go in the place of "number" to make the loop stop as soon as they enter the value they put in for the "count" input. I am also having trouble nesting a do while loop into the original while loop (if that is even what I am supposed to do to get the program to keep going if the user wants to enter more numbers???) I have inserted the question below, as...

  • Lab 5-2 Nested Loops 2. Summation Of Numbers (using Nested While Loops) Part A: The program...

    Lab 5-2 Nested Loops 2. Summation Of Numbers (using Nested While Loops) Part A: The program will calculate and display the total of all numbers up to a specific number (entered by the user). Only positive numbers are allowed. Part B: User-controlled loop Part A Input Validation loop Part A: Summation loop Examples: When 5 is entered the program will calculate the total as 1+2+...+5 and display 15. When 2 is enterered the program will calculate the total as 1+2...

  • PAYTHON PROGRAM WITHOUT ANY FUNCTION AND METHOD A program that will allow a grocery store to...

    PAYTHON PROGRAM WITHOUT ANY FUNCTION AND METHOD A program that will allow a grocery store to keep track of the total number of bottles collected for a seven-day period. The program should allow the user to enter the number of bottles returned for each day of the seven-day period. The program will accumulate the total number of bottles returned for the 7-day period. Then calculate the amount paid out (the total bottles returned times .10 cents). The output (display) of...

  • Write a program that asks the user for a student name and asks for grades until...

    Write a program that asks the user for a student name and asks for grades until the user enters a non-number input, it should then ask if the user wants to enter another student, and keep doing the process until the user stops adding students. The student’s must be stored in a dictionary with their names as the keys and grades in a list. The program should then iterate over the dictionary elements producing the min, max, and mean of...

  • In Python. Complete the following programs. Begin each program with a comment that includes: • Your...

    In Python. Complete the following programs. Begin each program with a comment that includes: • Your name • The project/program • Brief description of the problem Lab3Pro1 A supervisor in a manufacturing company wishes to display the bonus amount for an employee based on this year's production. Input Output Processing Distribute bonuses as follows: Display the results as follows: Prompt for user input "Enter number of Units produced" Store the amount entered Bonus This year's production bonus will be $nnnnn...

  • Write a program using M.I.P.S that asks user “how many positive number that is devisable by...

    Write a program using M.I.P.S that asks user “how many positive number that is devisable by 6 you want to add?” .Then your loopcounter would be the user input. If the user enters a positive number between 1 and 100 that is devisable by 6, you increment your loop counter and add it to the sum.. You need to decide if the positive number entered by the user is divisible by 6 or not. Your program should print an error...

  • I am required to use the try - catch block to validate the input as the...

    I am required to use the try - catch block to validate the input as the test data uses a word "Thirty" and not numbers. The program needs to validate that input, throw an exception and then display the error message. If I don't use the try - catch method I end up with program crashing. My issue is that I can't get the try - catch portion to work. Can you please help? I have attached what I have...

  • This is a c++ question we are not using namespace std at the top Subtraction +...

    This is a c++ question we are not using namespace std at the top Subtraction + Decision and Loop This is a twist on the previous exercise that will help you review loops and decision structures. You will again ask the user to enter two numbers. However, you will ALWAYS subtract the smaller number from the larger number to ensure that you never get a negative number for an answer. You do this by checking the numbers and switching them...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT