String Traversal and the for loop Computations are used to processing a string one character at a time. It starts at the beginning, select each character in turn and continue until the end. This pattern of processing is called a traversal . The for statement can iterate over the items of a sequence. A string is simply a sequence of characters and the for lo…
Read moreStrings Contents:- Introduction Compound data type String length Using the built-in function len. Using for loop and in operator. Using while loop and Slicing. Using string methods join and count. Introduction Strings are arrays of bytes representing Unicode characters. It is collection of one or more characters put in a single quote, double-quote or triple…
Read moreConditional execution The ability to check conditions and change the behaviour of the program accordingly. Conditional statements give us this ability. The simplest form is the if statement: if x > 0: print 'x is positive' The boolean expression after if is called the condition . If it is true, then the indented statement gets executed. If not, n…
Read moreAdd the following set of numbers: The Basic Model of Computation A model of computation is a model that describes how an output of a mathematical function is computed given an input. Describes how units of computations, memories, and communications are organized. Measured the computational complexity of an algorithm. Allows studying the performance of alg…
Read more
Social Plugin