Geeks' Corner

Topic in MAC OSX :




Python Tuples

We can tuple just like we create a list, except that we use regular brackets instead of square brackets. If we create a tuple with a single item, we need to include a comma at the end, otherwise we'll end up with a string. Tuples can hold different data types including lists so we can have a tuple with an element being a list. We access the values in a tuple by using the variable name with an index value enclosed in square brackets. We can also pick a range of values by using two indices se ...

Python Lists

Lists in Python can be created by just placing the sequence inside the square brackets. Unlike sets, list doesn't need a built-in function for creation of list. A list may contain duplicate values with their distinct positions. Elements can be added to the list by using the built-in append() function. Only one element can be added at a time to the list by using append() method. To add multiple elements with the append() method, loops are used. Tuples can also be added to the l ...

Naming Variables in Python

In Python, variables are created when they are first assigned. Variables must be assigned before being used. The value stored in a variable can be accessed or updated later. A variable can hold strings, numbers, or any other type of data.In Python, no declaration is required which means that a data type doesn't need to be declared. The Python interpreter allocates memory depending on what type of data is stored in the variable. ...

Classes in C#

A class definition starts with the keyword class followed by the class name; and the class body enclosed by a pair of curly braces. Access specifiers gives the access rules for the members as well as the class itself. The default access specifier for a class type is internal if not specified. Default access for the members is private if not specified. The data type specifies the type of variable, and return type specifies the data type of the data the method returns, if none, use void. ...