Category: PYTHON

FOR Loop

For Loop is used to iterate a task number of times. The loop allows traversal over an iterable objects like lists, tuple and strings. Syntax: >>> for val in sequence : . . .      body of for >>> else: . . .      body of else part   here val is a variable […]


Setting the Path On Windows Plateform, you can set the path as: set path=%path%;C:\python37 Typing an end-of-file character (Control-D on Unix, Control-Z on Windows) at the primary prompt causes the interpreter to exit with a zero exit status. If that doesn’t work, you can exit the interpreter by typing the following command: quit() Interactive Mode primary prompt : when […]

Calculator in Python

Calculator In python calculator is at primary prompt. Just write any expression and you get the answer. Numbers: do the following a primary command prompt. So, you have an inbuilt calculator, we can write complex expression, it is always better to enclose them in parenthesis. See example below: A division operator always leaves the result […]

Lists in Python

Lists Unlike strings which were immutable, list are mutable, that is we can change The most versatile is the list, which can be written as a list of comma-separated values (items) between square brackets. Lists might contain items of different types, but usually the items all have the same type. >>> >>> squares = [1, 4, […]

care4you © 2020 Connect On Facebook Protection Status