Category: Python

Python Range

Range function The Range function determine the number of iterations to be executed by FOR statement. The Range function cycle start with 0 and ends with the n-1 value. Examples Print range values >>> for c in range(3): print(c) 0 1...

Python Break

Break statement The Break statement is used in statements like for or while loop. If the condition is met, then you can use break statement to exit the loop. Examples >>> for n in range(1, 5): for x in range (3,...

Python Continue

Continue statement The Continue statement is used in statements like for or while loop. If the condition is met, then you can use continue statement to continue the loop. Examples >>> x = 3 >>> for c in range(1,8): if x...

Python Tuples

Tuples and Sequences The Python Tuple is a another standard sequence data type and consists of a number of values separated by commas. Tuples are immutable (object with a fixed value). Immutable objects (numbers, strings, tuples) can not be modified and...

Python Sets

Sets The Python data type set is an unordered collection with no duplicate elements. The elements inside the set are separated by commas. Examples Extract values from a set >>> my_set = {1, 2, 3, 8, 12} >>> my_set {8, 1,...