O'Reilly logo

Python for Experimental Psychologists by Edwin S. Dalmaijer

Stay ahead with the world's most comprehensive technology and business learning platform.

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

Start Free Trial

No credit card required

2 VARIABLE TYPES

 

 

 

 

 

Variables are very important in programming. Before learning about what they are and how to use them, perhaps it would be good to get some intuitive feeling for them. In the following sections, you will play around with all sorts of variable types to get a hang of things.

Numbers

Numbers can be represented in different ways. The most notable difference is between integers and floating points. An integer is a number without a fractional part, for example 10, 0, or ‒5. A floating point, or float, is a number with a fractional part, such as 1.23, ‒99.9, or 1.0.

Intuitively, it would seem floats can be used to be more precise. However, never say this when you are at a mathematician’s house party! Fractions can be ...

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

Start Free Trial

No credit card required