Python: Return Multiple Values from a Function
You can return multiple values by bundling those values into a dictionary, tuple, or a list. These data types let you store multiple similar values. You can extract individual values from them in your main program. Or, you can pass…
SQL Limit: A Beginner’s Guide
The SQL LIMIT statement restricts how many rows a query returns. A LIMIT statement appears at the end of a query, after any ORDER BY statements. You can start a LIMIT statement at a particular row using the offset argument.…
HTML Image: Step-by-Step Guide
The HTML <img> tag adds an image to a web page. Use the src attribute to specify the location of the image you want to bed. The alt attribute is often used to display text in place of an image…
Git Remove Remote: A Guide
The git remote remove command removes a remote URL from a repository. The syntax for this command is: git remote remove <remote-url>. You can only remove one remote at once. How to Remove a Git Remote Have you set the…
Python += Operator: A Guide
The Python += operator lets you add two values together and assign the resultant value to a variable. This operator is often referred to as the addition assignment operator. It is shorter than adding two numbers together and then assigning…
SQL Delete Row: A Guide
The SQL DELETE statement deletes a row from a database table. You can use the WHERE statement to specify which records should be deleted. If you do not specify a where statement, every row in the table will be deleted.…
Do While Python: A Step-By-Step Guide
The do while Python loop executes a block of code repeatedly while a boolean condition remains true. The Python syntax for while loops is while[condition]. A "do while" loop is called a while loop in Python. Most programming languages include…
How to Rename a Git Branch
To rename a Git branch, run the following command: git branch -m <old> <new>. This will change the name of the branch you are viewing to the new name you specify. You do not need to specify the old branch…
HTML Span: A Guide for Beginners
The HTML <span> tag lets you apply styles to a part of a web page or a paragraph. It is often used to stylize the text in a paragraph, such as by changing the color of a word. The <span>…
How to Code a Python QuickSort
A Python QuickSort selects a pivot element and splits the elements of an array into two new arrays. Numbers higher than the pivot go into one array; numbers lower than the pivot go into another. Each array is sorted and…
Python KeyError: A Beginner’s Guide
A Python KeyError is raised when you try to access an item in a dictionary that does not exist. You can fix this error by modifying your program to select an item from a dictionary that does exist. Or you…
Python for Loop: The Complete Guide
A Python for loop iterates over an object until that object is complete. For instance, you can iterate over the contents of a list or a string. The for loop uses the syntax: for item in object, where "object" is…
How to Write Python Functions
A Python function is a group of code. To run the code in a function, you must call the function. A function can be called from anywhere after the function is defined. Functions can return a value using a return…
Python Comment: A Step-By-Step Guide
A Python comment is a line of text in a program that is not executed by the interpreter. Comments are used during debugging to identify issues and to explain code. Comments start with a hash character (#). How to Comment…
Python Import Statements: A Guide
The Python import statement lets you import a module into your code. A module is a file that contains functions and values that you can reference from your program. The import statement syntax is: import modulename. Python is accompanied by…
How to Add a User to a Group in Linux
You can add a user to a group in Linux using the usermod command. To add a user to a group, specify the -a -G flags. These should be followed by the name of the group to which you want…
Python Variables: A How-To Guide
A Python variable stores a value in a program. Variables have two parts: a label and a value. These two parts are separated by an equals sign (=). You can use the label to refer to the value assigned to…
Python Random Choice: A How-To Guide
The Python random.choice() method returns an element selected at random from a list. random.choice() works on a list with items in any data type. random.choice() accepts one argument: the list from which you want to select an item. You may…
CSS Hover: A How-To Guide
The CSS :hover selector selects an element when you hover over that element with your cursor. For instance, you can use :hover to change the color of a link when you hover over the link. You may want to transition…
CSS Before and After Selectors: A How-To Guide
The CSS ::before selector inserts content before a selected element. CSS :after inserts content after a specified element. These selectors are commonly used to add text before or after a paragraph or a link. When you’re designing a website, you…
CSS Selectors: A How-To Guide
CSS selectors select the elements to which you can apply styles. The most basic selector is the element selector, which selects an element by its name. Other selectors include the id, class, universal, and descendant selectors. Selectors are one of…
JavaScript Spread Operator: A Guide
avaScript spread operator expands an array in syntax that accepts arguments. The spread operator is commonly used to duplicate objects, merge arrays or pass the contents of a list into a function. The spread operator. No, it’s got nothing to…
A 2020 Guide to While Loop in JavaScript
do...while loops can be used to execute a block of code once and will keep running if a statement continues to evaluate to true. while and do...while loops are useful if you want to execute a block of code while…
JavaScript Sort Array: A How-To Guide
You can use the JavaScript sort() method to sort an array. The sort() method accepts an array as an argument and sorts its values in ascending order. Arrays are sorted in place which means the original array is modified. A…
Python Pop: A Step-By-Step Guide
The Python pop() method removes an item at a specified index value from a list. This method returns the item you have removed so you know what modification has been made to your list. pop() accepts one argument: the index…
Python Find: A Guide
The Python find() method locates the index position at which the first instance of a string occurs in another string. find() returns -1 if a value cannot be found. Otherwise, it returns the starting index position of the value for…
Python String Strip: How To Use Python Strip
Python strip functions remove characters or white spaces from the beginning or end of a string. The strip functions are strip(), lstrip(), and rstrip(). They remove characters from both ends of a string, the beginning only, and the end only.…
JavaScript If Else: A Step-By-Step Guide
A JavaScript if...else statement evaluates whether a condition is true or false. If a condition is executed, the code within the if block executes. Otherwise, the contents of the else block execute. Else...if statements let you evaluate multiple conditions. There…
appendChild JavaScript: A Guide
The JavaScript appendChild() method adds an item to the end of a node. appendChild() is often used to add <li> items to a list. You must use multiple appendChild() statements if you want to add more than one item to…
Python Return: A Step-By-Step Guide
The Python return statement instructs Python to continue executing a main program. You can use the return statement to send a value back to the main program, such as a string or a list. Functions are blocks of instructions that…