Please boost your Plan to download papers
Programming using Python - Essay Example
Author : terrill94
Pages 13 (3263 words)
The pixel, or picture element appears to be a visible dot on the screen. However in reality, a pixel is not a square dot, rather it is an abstract sample whose color is defined by the variation in the intensity levels of the RGB (Red, Green, Blue) components or the CYMK (Cyan, Magenta, Yellow, Black) components.
The best looking spirals however, are those with only a small change in the value after every loop of the square, small values will generate the spiral with closely packed loops.
1. From the given statements (Print 12, print "12"), both the statements would print the value 12, The first statement (print 12) can only print the literal value 12 since variable names cannot begin with a number. However, (print a, print "a") statements would make a difference because 'print a' would print the value of able named 'a'.
The way of terminating the recursive function when the value of 'pow' reaches zero, is to use an 'if' condition to evaluate if the value of 'pow' has in fact reached below zero, thereby returning the value 1.
3. The power function from Section 5.3, uses a more efficient means of evaluating a number's exponent by using a more efficient mathematical expression, i.e the function recurses differently depending on whether the given number is even or odd by performing a modulo operation. By this method, the number of multiplications are reduced and thereby, is more efficient due to less memory usage and consumption. On the contrary, the Power function from Section 5.1 simply calls itself with a standard multiplication operator and thereby involves more multiplications and memory usage as a result of which, efficiency is the least. ...