Anda di halaman 1dari 2

PHYTON _ Lesson 1

Hi, my name is Filip and I'll be your host for _Introduction to Python for Data
Science_.
It's a long name, but that's to stress something: this is not just another Python
tutorial.
Instead, the focus will be on using Python specifically for data science. By the
end of this course, you'll know about powerful ways to store and manipulate data
and to deploy powerful data science tools for your own analyses.
You will learn Python for Data Science through video lessons, like this one, and
interactive exercises. You get your own Python session where you can
experiment and try to come up with the correct code to solve the instructions.
You're learning by doing, while receiving customized and instant feedback on
your work.
Python was conceived by Guido Van Rossum. What started as a hobby project,
soon became a general purpose programming language: nowadays, you can use
Python to build practically any piece of software. How did this happen? Well, first
of all, Python is open source. It's free to use. Second, it's very easy to build
packages in Python, which is code that you can share with other people to solve
specific problems. Throughout time, more and more of these package specifically
built for data science have been developed. Suppose you want to make some
fancy visualizations of your company's sales? There's a package for that.
Or what about connecting to a database to analyze sensor measurements?
There's also a package for that.
Currently, there are two common versions of Python, version 2.7 and 3.5 and
later. Apart from some syntactical differences, they are pretty similar, but as
support for version 2 will fade over time, our courses focus on Python 3. To install
Python 3 on your own system, follow the steps at this URL.
Now that you're all eyes and ears for Python, let's start experimenting. I'll start
with the Python shell, a place where you can type Python code and immediately
see the results.
In DataCamp's exercise interface, this shell is embedded here. Let's start off
simple and use Python as a calculator. Let me type 4 + 5 and hit Enter. Python
interprets what you typed and prints the result of your calculation, 9. The Python
shell that's used here is actually not the original one; we're using IPython, short
for Interactive Python, which is some kind of juiced up version of regular Python
that'll be useful later on.
Apart from interactively working with Python, you can also have Python run so
called python scripts. These python scripts are simply text files with the
extension _dot p y_. It's basically a list of Python commands that are executed,
almost as if you where typing the commands in the shell yourself, line by line.
Let's put the command from before in a script now, that can be found here in
DataCamp's interface. The next step is executing the script, by clicking 'Submit
Answer'.

If you execute this script in the DataCamp interface, there's nothing in the output
pane..That's because you have to explicitly use `print()` inside scripts if you
want to generate output during execution. Let's wrap our previous calculation a
in `print()` call, and rerun the script. This time, the same output as before is
generated, great!
Putting your code in Python scripts instead of manually retyping every step
interactively will help you to keep structure and avoid retyping everything over
and over again if you want to make a change; you simply make the change in the
script, and rerun the entire thing.
Now that you've got an idea about different ways of working with Python, I
suggest you head over to the exercises. Use the IPython Shell for
experimentation, and use the Python sript editor to code the actual answer. If
you click Submit Answer, your script will be executed and checked for
correctness. Have fun!

Anda mungkin juga menyukai