summaryrefslogtreecommitdiff
path: root/numbers.org
diff options
context:
space:
mode:
authorPuneeth Chaganti2010-04-21 14:43:08 +0530
committerPuneeth Chaganti2010-04-21 14:43:08 +0530
commitca66d8b170f9be95d208f72b6ab09434948387b2 (patch)
tree76fac0be12470cde922e7889338329bb8e6c3db1 /numbers.org
parent28c3ad7985f1c63f33c840f4900ac06ba0f686e5 (diff)
downloadst-scripts-ca66d8b170f9be95d208f72b6ab09434948387b2.tar.gz
st-scripts-ca66d8b170f9be95d208f72b6ab09434948387b2.tar.bz2
st-scripts-ca66d8b170f9be95d208f72b6ab09434948387b2.zip
Split data-files.org into numbers and strings.
Diffstat (limited to 'numbers.org')
-rw-r--r--numbers.org72
1 files changed, 72 insertions, 0 deletions
diff --git a/numbers.org b/numbers.org
new file mode 100644
index 0000000..d231d1a
--- /dev/null
+++ b/numbers.org
@@ -0,0 +1,72 @@
+* Data Types
+*** Outline
+***** Introduction
+******* What are we going to do?
+******* How are we going to do?
+******* Arsenal Required
+********* None
+*** Script
+ Welcome friends.
+
+ In this tutorial we shall look at data types available in Python and
+ how to perform simple Input and Output operations.
+ for 'Numbers' we have: int, float, complex datatypes
+ for Text content we have strings.
+ For conditional statements, 'Booleans'.
+
+ Lets get started by opening IPython interpreter.
+ Lets start with 'numbers'
+ All integers irrespective of how big they are, are of 'int'
+ data type
+ Now we will create a variable, say
+ x = 13
+ print x
+
+ To check the data type of any variable Python provides 'type' function
+ type(x)
+
+ y = 999999999999
+ print y
+
+ Floating point numbers comes under 'float'
+ p = 3.141592
+ type(p)
+
+ Python by default provides support for complex numbers.
+ c = 3+4j
+ c is a complex number. 'j' is used to specify the imaginary part.
+ type(c)
+ Python also provides basic functions for their manipulations like
+ abs(c) will return the absolute value of c(sqrt(a^2 + b^2))
+ c.imag returns imaginary part and c.real gives the real part.
+
+ Next we will look at Boolean datatype:
+ Its a primitive datatype having one of two values: True or False.
+ t = True
+ print t
+
+ Python is case sensitive language, so True with 'T' is boolean type but
+ true with 't' would be a variable.
+
+ f = not True
+
+ we can do binary operation like 'or' and 'not' with these variables
+ f or t
+ f and t
+
+ in case of multiple binary operations to make sure of precedence use
+ 'brackets ()'
+ a = False
+ b = True
+ c = True
+ (a and b) or c
+ True
+ first a and b is evaluated and then the 'or' statement
+ a and (b or c)
+ False
+
+ we come to the end of this tutorial on introduction of Data types in
+ Python. In this tutorial we have learnt what are supported data types,
+ supported operations and performing simple IO operations in Python.
+
+*** Notes