The UCSB surroundings tour guide!   Learning Objectives In this lab, you will Use Boolean operators (and/or/not) to specify a range Use if/elif/else to correctly select a place and produce the specified output Instructions Main Idea The UCSB surroundings tour guide! We assume that students want to spend their free time doing a little bit of sightseeing, and want to know when they can go if they know the distance that they can walk in miles. Since we do not really know where the user is, the result will not be very accurate. Create a program that returns one of the interesting places, available within a given distance in miles. (Some users do not like to do too much walking :) ) Return the corresponding trip destination based on the value of the user input using the following guidelines: [0 - 2]: "Lake Los Carneros Park" (2 - 7]: "Elings Park" (7 - 11]: "Gibraltar Rock" (11 - 20]: "Carpinteria State Beach" (20 - 30]: "Oxnard" (30 - 100]: "Los Angeles" Here, the open parenthesis ( , indicates that we are not including this value, and the square brackets [, ] mean that the value is included in the range. Steps Input (read) a valid integer and store it as the given distance. If the given distance is outside the range of [0 - 100], display the message Please enter a valid distance between 0 and 100 miles.. Write a function get_destination that takes the given distance as a parameter and returns the destination Call the function get_destination, when the given distance is within the [0 - 100] range) Print the message How about visiting , it is about miles away. where the destination is the return from the function get_destination Examples Input 8 Output How about visiting Gibraltar Rock, it is about 8 miles away. Input 30 Output How about visiting Oxnard, it is about 30 miles away. Input 120 Output Please enter a valid distance between 0 and 100 miles. Input -100 Output Please enter a valid distance between 0 and 100 miles.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

The UCSB surroundings tour guide!

 

Learning Objectives

In this lab, you will

  • Use Boolean operators (and/or/not) to specify a range
  • Use if/elif/else to correctly select a place and produce the specified output

Instructions

Main Idea

The UCSB surroundings tour guide!

We assume that students want to spend their free time doing a little bit of sightseeing, and want to know when they can go if they know the distance that they can walk in miles. Since we do not really know where the user is, the result will not be very accurate.

Create a program that returns one of the interesting places, available within a given distance in miles. (Some users do not like to do too much walking :) )

Return the corresponding trip destination based on the value of the user input using the following guidelines:

[0 - 2]: "Lake Los Carneros Park" (2 - 7]: "Elings Park" (7 - 11]: "Gibraltar Rock" (11 - 20]: "Carpinteria State Beach" (20 - 30]: "Oxnard" (30 - 100]: "Los Angeles"

Here, the open parenthesis ( , indicates that we are not including this value, and the square brackets [] mean that the value is included in the range.

Steps

  1. Input (read) a valid integer and store it as the given distance.
  2. If the given distance is outside the range of [0 - 100], display the message Please enter a valid distance between 0 and 100 miles..
  3. Write a function get_destination that takes the given distance as a parameter and returns the destination
  4. Call the function get_destination, when the given distance is within the [0 - 100] range)
  5. Print the message How about visiting <destination>, it is about <given_distance> miles away. where the destination is the return from the function get_destination

Examples

Input

8

Output

How about visiting Gibraltar Rock, it is about 8 miles away.

Input

30

Output

How about visiting Oxnard, it is about 30 miles away.

Input

120

Output

Please enter a valid distance between 0 and 100 miles.

Input

-100

Output

Please enter a valid distance between 0 and 100 miles.
LAB
4.19.1: LAB: The UCSB surroundings tour guide!
11/ 12
ACTIVITY
main.py
Load default template...
1 def get_destination(miles):
2
3
Type the function logic here
Return the corresponding trip destination based on the value of the user input using the following guidelines:
21: "Lake Los Carneros Park"
[0
(2
6
7]: "Elings Park"
(7 - 11]: "Gibraltar Rock"
(11 - 20]: "Carpinteria State Beach"
(20
(30 - 100] : "Los Angeles"
7
8
9
10
30]: "Oxnard"
11
12
13
14 if
name
main
":
15
'Type your code here'''|
Transcribed Image Text:LAB 4.19.1: LAB: The UCSB surroundings tour guide! 11/ 12 ACTIVITY main.py Load default template... 1 def get_destination(miles): 2 3 Type the function logic here Return the corresponding trip destination based on the value of the user input using the following guidelines: 21: "Lake Los Carneros Park" [0 (2 6 7]: "Elings Park" (7 - 11]: "Gibraltar Rock" (11 - 20]: "Carpinteria State Beach" (20 (30 - 100] : "Los Angeles" 7 8 9 10 30]: "Oxnard" 11 12 13 14 if name main ": 15 'Type your code here'''|
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY