viernes, 11 de enero de 2019

Hack #2. Describe the World Using Just Two Numbers

Hack #2. Describe the World Using Just Two Numbers

Most of the statistical solutions and tools presented in this book work only because you can look at a sample and make accurate inferences about a larger population. The Central Limit Theorem is the meta-tool, the prime directive, the king of all secrets that allows us to pull off these inferential tricks.
Statistics provide solutions to problems whenever your goal is to describe a group of scores. Sometimes the whole group of scores you want to describe is in front of you. The tools for this task are called descriptivestatistics. More often, you can see only part of the group of the scores you want to describe, but you still want to describe the whole group. This summary approach is called inferentialstatistics. In inferential statistics, the part of the group of scores you can see is called a sample, and the whole group of scores you wish to make inferences about is the population.
It is quite a trick, though, when you think about it, to be able to describe with any confidence a population of values when, by definition, you are not directly observing those values. By using three pieces of information—two sample values and an assumption about the shape of the distribution of scores in the population—you can confidently and accurately describe those invisible populations. The set of procedures for deriving that eerily accurate description is collectively known as the Central Limit Theorem.

Some Quick Statistics Basics

Inferential statistics tend to use two values to describe populations, the mean and the standard deviation.

Mean

Rather than describe a sample of values by showing them all, it is simply more efficient to report some fair summary of a group of scores instead of listing every single score. This single number is meant to fairly represent all the scores and what they have in common. Consequently, this single number is referred to as the central tendency of a group of scores.
Typically, the best measure of central tendency, for a variety of reasons, is the mean [Hack #21]. The mean is the arithmetic average of all the scores and is calculated by adding together all the values in a group, and then dividing that total by the number of values. The mean provides more information about all the scores in a group than other central tendency options (such as reporting the middle score, the most common score, and so on).
In fact, mathematically, the mean has an interesting property. A side effect of how it is created (adding up all scores and dividing by the number of scores) produces a number that is as close as possible to all the other scores. The mean will be close to some scores and far away from some others, but if you add up those distances, you get a total that is as small as possible. No other number, real or imagined, will produce a smaller total distance from all the scores in a group than the mean.

Standard deviation

Just knowing the mean of a distribution doesn't quite tell us enough. We also need to know something about the variability of the scores. Are they mostly close to the mean or mostly far from the mean? Two wildly different distributions could have the same mean but differ in their variability. The most commonly reported measure of variability summarizes the distances between each score and the mean.
As with the mean, the more informative measure of variability would be one that uses all the values in a distribution. A measure of variability that does this is the standard deviation. The standard deviation is the average distance of each score from the mean. A standard deviation calculates all the distances in a distribution and averages them. The "distances" referred to are the distance between each score and the mean.

TIP

Another commonly reported value that summarizes the variability in a distribution is the variance. The variance is simply the standard deviation squared and is not particularly useful in picturing a distribution, but it is helpful when comparing different distributions and is frequently used as a value in statistical calculations, such as with the independent t test [Hack #17].
The formula for the standard deviation appears to be more complicated than it needs to be, but there are some mathematical complications with summing distances (negative distances always cancel out the positive distances when the mean is used as the dividing point). Consequently, here is the equation:
image with no caption
S means to sum up. The x means each score, and the n means the number of scores.

Central Limit Theorem

The Central Limit Theorem is fairly brief, but very powerful. Behold the truth:
If you randomly select multiple samples from a population, the means of each of those samples will be normally distributed.
Attached to the theorem are a couple of mathematical rules for accurately estimating the descriptive values for this imaginary distribution of sample means:
  • The mean of these means (that's a mouthful) will be equal to the population mean. The mean of a single sample is a good estimate for this mean of means.
  • The standard deviation of these means is equal to the sample standard deviation divided by the square root of the sample size, n:
image with no caption
These mathematical rules produce more accurate results, and the distribution is closer to the normal curve as the sample size within any sample gets bigger.

TIP

30 or more in a sample seems to be enough to produce accurate applications of the Central Limit Theorem.

So What?

Okay, so the Central Limit Theorem appears somewhat intellectually interesting and no doubt makes statisticians all giggly and wriggly, but what does it all mean? How can anyone use it to do anything cool?
As discussed in "Know the Big Secret" [Hack #1], the secret trick that all statisticians know is how to solve problems statistically by taking known information about the distribution of some values and expressing that information as a statement of probability. The key, of course, is how one knows the distribution of all these exotic types of values that might interest a statistician. How can one know the distribution of average differences or the distribution of the size of a relationship between two sets of variables? The Central Limit Theorem, that's how.
For example, to estimate the probability that any two groups would differ on some variable by a certain amount, we need to know the distribution of means in the population from which those samples were drawn. How could we possibly know what that distribution is when the population of means is invisible and might even be only theoretical? The Central Limit Theorem, Bub, that's how! How can we know the distributions of correlations (an index of the strength of a relationship between two variables) which could be drawn from a population of infinite possible correlations? Ever hear of the Central Limit Theorem, dude?
Because we know the proportion of values that reside all along the normal curve [Hack #23], and the Central Limit Theorem tells me that these summary values are normally distributed, I can place probabilities on each statistical outcome. I can use these probabilities to indicate the level of statistical significance (the level of certainty) I have in my conclusions and decisions. Without the Central Limit Theorem, I could hardly ever make statements about statistical significance. And what a drab, sad life that would be.

Applying the Central Limit Theorem

To apply the Central Limit Theorem, I need start with only a sample of values that I have randomly drawn from a population. Imagine, for example, that I have a group of eight new Cub Scouts. It's my job to teach them knot tying. I suspect, let's say, that this isn't the brightest bunch of Scouts who have ever come to me for knot-tying guidance.
Before I demand extra pay, I want to determine whether they are, in fact, a few badges short of a bushel. I want to know their IQ. I know that the population's average IQ is 100, but I notice that no one in my group has an intelligence test score above 100. I would expect at least some above that score. Could this group have been selected from that average population? Maybe my sample is just unusual and doesn't represent all Cubbies. A statistical approach, using the Central Limit Theorem, would be to ask:
Is it possible that the mean IQ of the population represented by this sample is 100?
If I want to know something about the population from which my Scouts were drawn, I can use the Central Limit Theorem to pretty accurately estimate the population's mean IQ and its standard deviation. I can also figure out how much difference there is likely to be between the population's mean IQ and the mean IQ in my sample.
I need some data from my scouts to figure all this out. Table 1-1 should provide some good information.

Table 1-1. Scout smarts
ScoutIQ
Jimmy100
Perry95
Clark90
Lex92
Neil85
Billy88
Greg93
John91
The descriptive statistics for this sample of eight IQ scores are:
  • Mean IQ = 91.75
  • Standard deviation = 4.53
So, I know in my sample that most scores are within about 41/2 IQ points of 91.75. It is the invisible population they came from, though, that I am most interested in. The Central Limit Theorem allows me to estimate the population's mean, standard deviation, and, most importantly, how far sample means will likely stray from the population mean:
Mean IQ
Our sample mean is our best estimate, so the population mean is likely close to 91.75.
Standard deviation of IQ scores in the population
The formula we used to calculate our sample standard deviation is designed especially to estimate the population standard deviation, so we'll guess 4.53.
Standard deviation of the mean
This is the real value of interest. We know our sample mean is less than 100, but could that be by chance? How far would a mean from a sample of eight tend to stray from the population mean when chosen randomly from that population? Here's where we use the equation from earlier in this hack. We enter our sample values to produce our standard deviation of the mean, which is usually called the standard error of the mean:
image with no caption
We now know, thanks to the Central Limit Theorem, that most samples of eight Scouts will produce means that are within 1.6 IQ points of the population mean. It is unlikely, then, that our sample mean of 91.75 could have been drawn from a population with a mean of 100. A mean of 93, maybe, or 94, but not 100.
Because we know these means are normally distributed, we can use our knowledge of the shape of the normal distribution [Hack #23] to produce an exact probability that our mean of 91.75 could have come from a population with a mean of 100. It will happen way less than 1 out of 100,000 times. It seems very likely that my knot-tying students are tougher to teach than normal. I might ask for extra money.

Where Else It Works

A fuzzy version of the Central Limit Theorem points out that:
Data that are affected by lots of random forces and unrelated events end up normally distributed.
As this is true of almost everything we measure, we can apply the normal distribution characteristics to make probability statements about most visible and invisible concepts.
We haven't even discussed the most powerful implication of the Central Limit Theorem. Means drawn randomly from a population will be normally distributed, regardless of the shape of the population. Think about that for a second. Even if the population from which you draw your sample of values is not normal—even if it is the opposite of normal (like my Uncle Frank, for example)—the means you draw out will still be normally distributed.
This is a pretty remarkable and handy characteristic of the universe. Whether I am trying to describe a population that is normal or non-normal, on Earth or on Mars, the trick still works.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.


https://the-eye.eu/public/Books/HumbleBundle/

"Estados Unidos le robó Tejas a México" - Vladimir Putin, Presidente de...

PUTIN demuestra su misil poderoso supersónico - TIEMBLA TRUMP






el poderio científico y tecnológico ruso

martes, 8 de enero de 2019

Physics and jobs


 
Richard Muller, Prof Physics, UCBerkeley, author of "Now—The Physics of Time" (2016)
Every graduate with a PhD in physics I know, within a year of graduation, had a job that other people would only dream about.  A PhD in physics gives the student a broad background in technology and in determination of truth/falsehood.  Seen in that light, it is the best general education one can get. 
But if you are determined to be a professor, then your odds are poor.  That kind of job depends not just on student quality, but also on luck: what jobs are available.
I know PhDs in physics who went on to become professors, to become head of research units in geophysics lab, director of analysis of planetary science in NASA, patent attorney (earning more than virtually anyone else in this list), analyst for the CIA (e.g. the chief of Russian studies), director of research foundations, consultant for McKinsey (they are always looking for physics PhDs), founder of technical startup companies, teachers, computer experts (working for IBM), technical developers (working for Hewlett Packard), etc.  Most people consider these to be jobs to die for.
I know of several PhDs who are unhappy, not because they couldn't find work, but because they could not get their dream position.  One of these people is earning only $120,000 per year as a computer programmer -- so he is unhappy.  Another quit a good job to begin a startup, and it failed. So he is unhappy.
There is no better degree to earn than a PhD in physics, if you want to have a great range of opportunity in your future life.


As a physicist who left physics — though always having dreamt of returning — and who went on to economics, getting a Ph.D. in the economics of innovation, I can say this as a general answer to your question.
Note: This text is a tongue-in-cheek argument, and to paraphrase what the great economist Ken Arrow said in a different context,
those believing this is a description of the reality of a former physicist, have completely failed to understand the purpose of the exercise!
Ph.D. in theoretical and mathematical physics will provide you with one of the most versatile backgrounds, giving you general tools and ways of analysing problems, that are applicable in almost all types of work later.
While you are pursuing a Ph.D. in this field, you will have some serious fun! You will feel how wonderful it is to be among equals, to be among friends and colleagues that understand — and share — your zest, your complete immersion in fascinating problems. They share your delight in always being challenged, and the joy in solving new problems … together.
They share your concept of aesthetics, of what is beautiful. The simpler the better. Beauty lies in the simplicity of expression and richness in content. In a way, like a Pandora’s box without all the ugliness and evil! If the answer is not beautiful, the answer is wrong.
And you will always look back at your grad.school and post-doc periods as the best time of your life.
When you, eventually, leave academic research — as you very probably, 99 to 100, will — you will discover that your background has completely changed the way you see the world. In fact it will have completely changed your understanding of the world, as well as your total world view.
And this, you will think, is a good thing! Because now you cannot wait to use all of this, to improve the world for your fellowmen and -women. You can’t wait to use your resources and your boundless energy to improve the common good. To improve the Common Wealth, as Adam Smith denoted it, when he spoke as a moral philosopher!
Your personal goals lies in what you can do for the world, not what the world can do for you! By this time in your life the objectives of your own personal and economic gains are not just secondary, they are completely irrelevant.
You are not, as Frank Zappa claimed to be, only in it for the money! Nor are you in it for fame or glory. You are living for those “Heureka!” moments — where the solution to the problem you have been endlessly toiling with, suddenly is revealed to you.
The moments when you suddenly see it in the right perspective — where every piece of the puzzle falls into place. The moment when the overall picture is shown to you. When you know in every fiber of your body that this is the solution. And it is … oh, so simple … oh, so beautiful!
On the other hand, your period in theoretical physics – and your new world view – will have fundamentally changed you. Your new world view will be something you share with a very few others. And you will forever feel that no one understands your position. For the rest of your life, you will feel totally estranged from most other people.
From this point on, you will very often hear that you, quite unnecessarily as the argument goes, complicate things. Even though what — seen from your perspective — you are doing is simplifying the issues. Simplifying it for the decision makers that ask for your advice, as well as for those that don’t … ask!
You will have to live with being ridiculed, and live with the frustration – that people around you do not see the issues clearly, are unable to see the solution lying right in front of them.
You have to accept that whatever you see as simple, and easily understood, those around you will claim is complex, and totally incomprehensible.
You will be good at structuring and solving problems, but you will have to do with a lot what-aboutism. Most of your colleagues and peers will not have any understanding of how to build a simplified model of a phenomenon or a problem. In particular, they will not be able to distinguish between 0.1%- and 10%-factors of input. And when you are certain you finally managed to convince them, yesterday, you are back to square one tomorrow.
At some time you will say — and trust me, sooner or later you will say this, or something to the same extent — I am simple-minded, I really believe that things are simple, and you will go on to claim that it is a question of having the right tools, and the knowledge of how to use them.
You will truly believe that any individual will see — and accept — what you see! And that they will act on it. Provided they are given the means and tools to understand the issues.
You strongly believe that any individual is open-minded and truth-seeking, and all individuals are, just as you believe you are yourself, focussed on learning new things, on discovering new aspects, on understanding the world around us. Of letting truth decide.
Any debate is – in your mind – about being open, of listening to and developing arguments, based on the quality of the arguments. You abhor and never make ad hominem arguments, and you will never ridicule or misrepresent the arguments of your opponent. You will always be open to having misunderstood his or her arguments. You will always see the debate as providing a potential for learning something new!
You truly believe everyone live — just as you do — by Max Planck’s adage: “The more I know, the more I know that I do not know!” So every new problem, and every meeting with another, is a chance to learn new things. You never approach them with preconceived notions of how problems should be solved, or what the other represents.
At just that moment when you say that you believe in the simple — in effect that you believe “In simplicitate bellitasthat beauty resides in simplicity — you will immediately come to see the total error of your ways. All of your opponents will grab the chance immediately, to claim you are a simpleton. Whatever you say after this, won’t count. From that moment onwards, it may be completely disregarded.
You are not just simple-minded, you confuse things and do not understand the – political/economical/cultural/social [strike out what is not applicable in the situation] – aspects of the issue. This is what they will say about you! And you will see that most of those around you will accept this.
Whenever this happens, please note that what it really means, is that you have gotten too close to the basis of the powers that reign.
You have to always remember, that it is totally irrelevant if you are right or wrong — if you are alone, you really are alone. The majority always has the right of way whenever political/economical/cultural/social power and Macht are involved. If the majority tells you that you have misunderstood the issues at hand — even if you know this is wrong — the majority has always the right to decide what is «right»!
You have to live with being misunderstood and exploited, getting your arguments and messages ridiculed and turned into jokes. But you will also see, in the end, at several occasions, that you were the one that understood the issues.
However, in those instances – when reality proves you right – no one will remember your inputs into the discussion. Some business school MBA will now probably get the credit for solving the problem, months and even years after you pointed your organization towards the correct solution.
A few of the people around you will also see – and remember – that you were right and they will support you. Value their support and their friendship. And trust their assessments and advice. Even at times when you feel down and out.
Do not get despondent, remember that your real friends will see … and remember your inputs on the issue. And stick to your original goal – it is not about fame, glory or rewards. Revel in a job well done – for the common wealth!
And lastly, whatever you do, do not — ever — write an equation and describe its solution in mathematical terms, to emphasize your points about the problem at hand. To use them to show what you see as the underlying simplicity of the problem — or even worse, to describe the beauty of the solution. If you ever do this, you will experience what it truly means to be an outcast. To watch the blindfolds shutting over the eyes and ears of your audience, to see them blotting you completely out of their perception!
Thinking back, the situation reminds me of the joke on Tricky Dick Nixon in 1974 on the cover of the MAD journal. The cover’s pun played on the three monkeys at one of the shrines in the temple park at Nikko, north of Tokyo. The ones saying resp. “hear/see/speak no evil”. Nixon got the first two right, at the last one he threw his hands up, shrugging his shoulders, and said, “Well, two out of three ain’t bad?
In the situation you are going to experience, this situation is turned around. As seen from your audience’s position, they get only one right! And they, in contrast to Richard Nixon, never speak evil!
So if you want a life that is frustrating, that many times will feel like struggling uphill with a strong gale in your face, but also a life that will give you lots of personal satisfaction, then, sure, go for it!
Provided one thing. You have to burn for theoretical physics, and I mean: really burn for it. Only do it if you feel – in your heart – that your identity really isbeing a physicist!
And always remind yourself of the theoretical physicists’ light bulb joke:
Q: How many theoretical physicists are needed to change a broken light bulb?
A: I have absolutely no idea! … But what I do know, is that 600 applied for the job!
If you don’t feel the burn, then forget it. Find something else to do!


Common job titles for physics and engineering physics bachelor's degreerecipients include:
  1. Accelerator Operator.
  2. Applications Engineer.
  3. Data Analyst.
  4. Design Engineer.
  5. High School Physics Teacher.
  6. IT Consultant.
  7. Lab Technician.
  8. Laser Engineer.

Learn to code

When you can code, you control your own destiny (or at least you’ll be
able to program your internet-connected lawn sprinker system). But how do
you learn to code?
First, learn to think computationally. Next, you grab a
programming language so you can speak the same lingo as your computer,mobile device, or anything with a CPU. What’s in it for you? More time,
more power, and more creative possibilities to do the things you really want
to do. Come on, let’s get started...

Breaking it down
The first thing that stands between you and writing your first real piece of
code is learning the skill of breaking problems down into achievable little
actions that a computer can do for you. Of course, you and the computer will
also need to be speaking a common language, but we’ll get to that topic in
just a bit.



You can think of these statements as a nice recipe for fishing. Like any
recipe, this one provides a set of steps that, when followed in order, will
produce some result or outcome (in our case, hopefully, catching some fish).
Notice that most steps consist of a simple instruction, like “cast line into
pond,” or “pull in the fish.” But also notice that other instructions are a bit
different because they depend on a condition, like “is the bobber above or
below water?” Instructions might also direct the flow of the recipe, like “if
you haven’t finished fishing, then cycle back to the beginning and put another
worm on the hook.” Or, how about a condition for stopping, as in “if you’re
done, then go home”?
You’re going to find that these simple statements or instructions are the
foundation of coding. In fact, every app or software program you’ve ever
used has been nothing more than a (sometimes large) set of simple
instructions to the computer that tell it what to do


Actually, a recipe is a perfectly good way to describe a set of instructions to
a computer. You might even run into that term loosely used here and there in

more advanced programming books. Heck, you’ll even find books on
common software development techniques that are called cookbooks. That
said, if you want to get technical we can—a computer scientist or serious
software developer would commonly call a recipe an algorithm. What’s an
algorithm? Well, not much more than a recipe—it’s a sequence of
instructions that solves some problem. Often you’ll find algorithms are first
written in an informal form of code called pseudocode.In this book, you’ll hear us interchange all these terms, where appropriate—
and, oh, in your next job interview you might want to use the term algorithm
or even pseudocode to ensure that larger signing bonus (but there’s still
nothing wrong with the word recipe).


The world of programming languages
If you’re reading this book you may have, in passing, heard about various
programming languages. Just walking through the programming section of
your local bookstore you might encounter Java, C, C++, LISP, Scheme,
Objective-C, Perl, PHP, Swift, Clojure, Haskell, COBOL, Ruby, Fortran,
Smalltalk, BASIC, Algol, JavaScript, and of course Python, to name just a
few. You might also be wondering where all these names came from. The
truth is, programming language names are a lot like the names of rock bands
—they’re names that meant something to the people who created the
language. Take Java, for instance: it was named, not surprisingly, after coffee (the preferred name Oak was already taken). Haskell was named after a
mathematician, and the name C was chosen because C was the successor of
the languages A and B at Bell Labs. But why are there so many languages
and what are they all about? Let’s see what a few folks have to say about the
languages they use:


PYTHON
it's considered one of the best languages for beginners because it’s such a
readable and consistent language. It’s also a powerful language in that no
matter what you want to do with it (now or beyond this book), you can find
support in terms of code extensions (we call them modules or libraries) and a
supportive community of developers to give you a hand. Finally, some
developers will even tell you Python is just more fun than other languages. So
how can we go wrong?

Q: What’s the difference between learning to code and thinking
computationally? Is the latter just a computer science thing?
A: Computational thinking is a way of thinking about problem solving that
grew out of computer science. With computational thinking we learn how to
break problems down, to create algorithms to solve them, and to generalize
those solutions so we can solve even bigger problems. Often, though, we
want to teach a computer to execute those algorithms for us, and that’s where
coding comes in. Coding is the means by which we specify an algorithm to a
computer (or any computational device, like your smartphone). So the two
really go hand in hand—computational thinking gives us a way to create
solutions to problems that we want to code, and coding provides a means of
specifying our solutions to a computer. That said, computational thinking can

be valuable even if you aren’t coding.


PYTHON HISTORY

Over in the Netherlands, at the National Research Institute for Mathematics
and Computer Science, they had a big problem: their scientists found
programming languages difficult to learn. Yes, even to these highly educated,
skilled scientists, the most current programming languages were confusing
and inconsistent. To the rescue, the Institute developed a new language called

“ABC” (you thought we were going to say “Python,” didn’t you?), which

was designed to be much easier to learn. While ABC was somewhat
successful, an enterprising young developer named Guido van Rossum, after
a weekend of binge-watching Monty Python reruns, thought he could take
things further—so, using what he’d learned from ABC, Guido created

Python. And the rest is history.

Good question. And you’re right, there are two versions of Python—to be a
little more specifc, at the time this book was printed, the current versions are

3.6 and 2.7.


Python: One of the reasons newbies and professionals appreciate me is
because my code is quite straightforward and readable. Ever look at a
language like, say, Java? Blech. My gosh, the effort you have to go to just

to say, “Hello World!” That takes a single line of Python code.

Python: Given I mentioned Java, let me just give you a little example.
Let’s say you want to tell your user “Hello!” Here’s how you do it with
Java:
class HelloWorldApp {
public static void main(String[] args) {
System.out.println(“Hello!”);
}
}
That’s a lot to take in. I’d call it totally unreadable, especially to someone
just learning to program. What the heck does all that mean, anyway? Is
all that really necessary? Now let’s look at my version, which I’ve
written in Python of course:

print(‘Hello!’)

I think you’d have to agree that is more straightforward and readable—
anyone can look at that line and have a decent idea of what it does. But
that’s just a simple example. Overall, Python strikes people as clear,
almost English-like, and consistent...

Head First: Consistent? What does that mean?

Python: One way to think about consistency is that there aren’t a lot of
surprises in the language. In other words, once you understand a bit of the
language, other things tend to work as you might guess, or expect. Not all

languages are like that.


Python: The space shuttle? You made that up. For the others, I was
giving you examples of things you might consider serious, given that you
claimed Python was otherwise. Some of the most common uses of Python
are for things like creating websites, writing games, and even creating

desktop apps.

Head First: Can we switch gears? Someone just handed me a note: our
sources tell us that there are actually two versions of Python, and what’s
more, they are actually… gosh, how do I say it, incompatible with each
other. How on earth is that being consistent?
Python: Like anything, languages tend to grow and evolve, and yes,
there are two version of Python, version 2 and version 3. Version 3 has
new things in it that were not part of version 2, but there are ways to
make things backward compatible. Let me walk your readers through…
Head First: ...on that note, we’re out of time. We look forward to our
next ambush, er, I mean opportunity, to speak with you.

Python: Thanks, my pleasure…I think.


Phraseomatic

import random
verbs = ['Leverage', 'Sync', 'Target',
'Gamify', 'Offline', 'Crowd-sourced',
'24/7', 'Lean-in', '30,000 foot']
adjectives = ['A/B Tested', 'Freemium',
'Hyperlocal', 'Siloed', 'B-to-B',
'Oriented', 'Cloud-based',
'API-based']
nouns = ['Early Adopter', 'Low-hanging Fruit',
'Pipeline', 'Splash Page', 'Productivity',
'Process', 'Tipping Point', 'Paradigm']
verb = random.choice(verbs)
adjective = random.choice(adjectives)
noun = random.choice(nouns)
phrase = verb + ' ' + adjective + ' ' + noun

print(phrase)


NOTE
random.choice is another built-in function from Python. We’ll learn more about these
later in the book.



Computers really only do two things well: store values and perform
operations on those values. You might think they’re doing a whole lot more,
as you send texts, shop online, use Photoshop, or rely on your phone to
navigate in your car; however, everything computers do can be broken down DESCARTES
into simple operations that are performed on simple values. Now, part of

computational thinking is learning to use these operations and values to build something that is much more sophisticated, complex, and meaningful—
and we’re going to get to that. First, though, we’re going to take a look at
what these values are, the operations you can perform on them, and just what
role variables play in all this.


*****************+

http://programming.itcarlow.ie/resources.html

Q:But a buddy of mine told me I
should learn Java or C#. Why are you
not using either of these programming
languages in this book?
A: Both Java and C# are great
programming technologies, but they can be
difficult to learn, especially when you are
just starting out. This is not the case with
Python. And, anyway, this is a book that’s
designed to teach you how to program, and

using Python as your first programming
language will help us to do just that.



There seems to be many different
versions of Python. Which should I use?
A: There are two main releases of
Python: 2 and 3. This book is based on
release 3 of the language. Python 3 is the
future of the language; any new features
are guaranteed to be added to release 3
of the language, not release 2. Of course,
like all releases, Python 3 remains a free
download, which makes it a no-brainer

when decidiing if you can afford to use it.

Q: What does int(g) mean?
A: It tells Python to interpret the user’s
input as a number rather than a letter.
Within programming languages, the number

5 is different than the letter ‘5’.
Q: So what if I had not typed a
number when I was asked for a guess?
What if I’d just entered my name or
something?
A: The code would have crashed with an
error. In fact, Python will complain that the
program crashed with a “ValueError” (more

on these error messages later in the book).


zen consultora

Blogger Widgets

Entrada destacada

Platzy y el payaso Freddy Vega, PLATZI APESTA, PLATZI NO SIRVE, PLATZI ES UNA ESTAFA, Platzy and the Clown Freddy Vega, PLATZI SUCKS, PLATZI IS A SCAM

  Platzy and the clowns Freddy Vega and Cvander – Part 1, PLATZI IS A SCAM Hello friends, this post will keep growing as I continue writing...