Git Product home page Git Product logo

assignment-2's Introduction

Assignment 2

Now that you have most of your Python environment installed, we're going to start getting used to some interesting things about Python, before we make a side trip to talk about regular expressions.

Running Python

The following is a very short program - you should recognize what it does:

#!/usr/bin/env python
# encoding: utf-8

"""
my first little program

Created by Brant Faircloth on 18 Jan 2016.
Copyright 2016 Brant C. Faircloth. All rights reserved.

"""

import sys

print("Python {}".format(sys.version_info))
print("Hello world")

  1. Take 3 screenshots showing 3 of the different ways that you can run the contents of the program above. It does not matter which 3 you use, just that they are different. I can think of at least 4 ways to do this, and there are probably several more.

Imports

The following lines of code all import pieces of the numpy module in different ways:

import numpy

from numpy import *

from numpy import random

  1. How are these different from each other? Be specific.
  2. Which of the above do you think is preferred? Why?
  3. What happens to the stdlib module random if you run from numpy import random? Provide an example.

Paths

Paths are really important. Paths are also really confusing and they can be really frustrating, because the term path can actually have a couple of different meanings.

  1. On your computer, create a file on the Desktop. What's the path to that file (e.g. the file path)?
  2. If you created a file in the root directory of your computer, what would that file path be?
  3. On your computer, there is a setting/variable called $PATH. What does that setting do?
  4. On your computer, there is a setting/variable called $PYTHONPATH. What does that setting do?

Modules

  1. Pick a module from the Python stdlib or a third-party module. Write a 250 word summary of the purpose of that module and how it might be useful to you as we move through this class. Feel free to do this in iPython and include examples to make your points clearer (or to briefly illustrate what the module does). Feel free also to look at the documentation of that module and/or any online resources, but please cite those.

assignment-2's People

Contributors

andremonc avatar aus10webber avatar brantfaircloth avatar eeliz1 avatar gcagle1 avatar glaudelrio avatar hensonmw avatar jonnations avatar jsalt avatar marcoarego avatar mforoozani1 avatar mukkuchagit avatar pramodpantha avatar reige012 avatar sthshraddha avatar turneraj avatar zcarver avatar

Watchers

 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.