equal
deleted
inserted
replaced
382 >>> abs(cplx) #returns the absolute value of the complex number |
382 >>> abs(cplx) #returns the absolute value of the complex number |
383 5.0 |
383 5.0 |
384 |
384 |
385 Python provides a datatype for complex numbers. Complex numbers are initialized |
385 Python provides a datatype for complex numbers. Complex numbers are initialized |
386 as shown in the example above. The *real* and *imag* operators return the real and |
386 as shown in the example above. The *real* and *imag* operators return the real and |
387 imaginary parts of the complex number as shown. The *abs()* returens the absolute |
387 imaginary parts of the complex number as shown. The *abs()* returns the absolute |
388 value of the complex number. |
388 value of the complex number. |
|
389 |
|
390 Variables |
|
391 ~~~~~~~~~ |
|
392 |
|
393 Variables are just names that represent a value. Variables have already been |
|
394 introduced in the various examples from the previous sections. Certain rules about |
|
395 using variables: |
|
396 |
|
397 * Variables have to be initialized or assigned a value before being used. |
|
398 * Variable names can consist of letters, digits and underscores(_). |
|
399 * Variable names cannot begin with digits, but can contain digits in them. |
|
400 |
|
401 In reference to the previous section examples, 'a', 'b', 'lng', 'fl', 'e' and 'cplx' |
|
402 are all variables of various datatypes. |
|
403 |
|
404 :: |
|
405 |
|
406 Note: Python is not a strongly typed language and hence an integer variable can at a |
|
407 later stage be used as a float variable as well. |
|
408 |
|
409 Strings |
|
410 ~~~~~~~ |
|
411 |