Giter VIP home page Giter VIP logo

cssi-4.9-python-user-input-lab's Introduction

User Input Mini App

Let's build a simple input/output app. The main objective is to create an application that takes in user input, does something with that input, and then prints out an output.

Get User Input

The first thing we need to do is take in user input with the raw_input() method. When an executed Python program hits the method raw_input(), the program pauses and waits for the user to enter text into the terminal.

The way raw_input() takes in data from the user is important to remember. It does not interpret the data entered, it merely returns exactly what the user enters, the raw data. The second thing to remember is that raw_input() takes exactly one line of input. Once the user presses enter, what is on that line is what raw_input() returns.

The Challenge: A Visit to My Favorite City

Let's build an application to plan tourists' visits to your favorite city. Create a new file with touch trip.py in terminal. Open trip.py with Atom to start writing your program - open Atom trip.py.

Ask the user where they would like to stay, what sites they want to visit, what food they want to eat, and how many nights they want to stay. For each question, take input from the user and store it in a variable.

Once you have that input stored, use string methods (upper(), lower(), capitalize(), etc) to put the input in the proper format. You can always take a look at the Python documentation here to learn more about string methods you can use.

Your final output should use string interpolation to output the data in a full summary of their trip itinerary. The output should look like this:

Destination: Washington DC Sites:

  • Visiting the Washington Monument
  • Visiting the Air And Space Museum
  • Visiting the White House Food: Burgers and Fries Nights: 3

Remember, you can execute your code by typing python trip.py in terminal from inside the directory of this lab. Good luck!

View User Input Mini App on Learn.co and start learning to code for free.

cssi-4.9-python-user-input-lab's People

Contributors

fislabstest avatar georgiadavis avatar sarogers avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.