Data Types

Cai Gengyang gengyangcai at gmail.com
Wed Sep 21 00:03:40 EDT 2016


On Wednesday, September 21, 2016 at 11:22:42 AM UTC+8, Steve D'Aprano wrote:
> On Wed, 21 Sep 2016 01:00 pm, Cai Gengyang wrote:
> 
> > So I am going through chapter 7.1 (Data Types) of
> > http://programarcadegames.com/index.php… What do these terms (input and
> > output) mean --- Can someone explain in plain English and layman's terms ?
> 
> http://www.dictionary.com/browse/input
> 
> http://www.dictionary.com/browse/output
> 
> 
> Does that answer your question about "input and output"?
> 
> 
> > Thanks a lot ...
> > 
> >>>> type(3)
> > <class 'int'>
> >>>> type(3.145)
> > <class 'float'>
> >>>> type("Hi there")
> > <class 'str'>
> >>>> type(True)
> > <class 'bool'>
> 
> I don't understand why you are showing this. What part don't you understand?
> 
> The number 3 is an int (short for integer); that is the type of value it is.
> 5 is also an int, and 0, and 9253, and -73. They are all integers.
> 
> 3.145 is a float (short for "floating point number"). "Hi there" is a str
> (short for string). True is a bool (short for Boolean value, which is a
> technical term for special True/False values).
> 
> Perhaps if you can ask a more clear question, I can give a more clear
> answer.
> 
> 
> 
> 
> -- 
> Steve
> “Cheer up,” they said, “things could be worse.” So I cheered up, and sure
> enough, things got worse.

Right, 

So for example for "bool" , it only applies to True/False and nothing else? (2 data types), i.e. :

>>> type(True)
<class 'bool'>
>>> type(False)
<class 'bool'>

Are there any other data types that will give you type(A) or type(B) = <class 'bool'> besides True and False?

Regards,

GY




More information about the Python-list mailing list