Muhammad Asfour When using Math.random() in JavaScript we create a random number between 0 and less than 1. What if we want to create a random number that is greater than
Muhammad Asfour We can use JavaScript's FileReader object which is part of the Web API in order to hash our file. FileReader allows us to asynchronously "read the content
Muhammad Asfour I recently wanted to programmatically create several objects with dynamic keys inside another object (basically an object of objects) when working with Typ
Muhammad Asfour never is a data type of values that will never happen. We use never in a function that will never reach the end of that function or when narrowing a type t
Muhammad Asfour Introduction
The unknown type in TypeScript is a type which we can assign any value of any data type to while still leveraging TypeScript's type checking.
Muhammad Asfour Conditional types in TypeScript are types are created on the basis of a condition.
Structure
type nameOfType = aType extends anotherType ? TrueType : Fal
Muhammad Asfour TypeScript gives us as powerful feature called mapped types, which allows us to iterate (map) over different types or a union of different types and merge
Muhammad Asfour Introduction
Functions in which the return value is a boolean and is used in order to determine what data type is a variable is known as a Type Predicate.
Muhammad Asfour Type and Type alias
A type is used how our data will look (e.g. number, string, Array, etc.). A type alias gives us a way of assigning names that we choos
When a variable is declared, it is accessible in areas of the program that are after where was it declared. For example, if you declare a variable outside
Python has styling conventions. These styling conventions are defined in the Python Enhancement Proposals (PEP8). Here are the condensed version of the r
In Python, any file that has a py file extension (a Python file) is considered a module. This allows us to import these modules into other files.
Suppose
We are able to program using Object Oriented Programming (OOP) in Python. We can create classes, objects and methods.
Examples
A class is defined in the
Muhammad Asfour Sets are another important data structure in Python. They differ from dictionaries in that they don't have keys and they differ from tuples in that they a
Muhammad Asfour Another data structure in Python are dictionaries. Dictionaries allow us to create a collection composed of key/value pairs.
Examples
person = {'name': '
Muhammad Asfour Tuples are another data structure available in Python. Tuples give us the ability to create objects that are immutable.
One of the differences between tu
Muhammad Asfour Lists are one of the data structures in Python. It is considered an important data structure in Python.
Examples
A list of integers:
numbers = [1,2,3]
Muhammad Asfour As stated in a previous blog post, all data types in Python are objects. Objects are composed of methods and attributes. In Python these are accessed usin
Muhammad Asfour An overview of functions in Python
Muhammad Asfour The types of loops in Python and how they work.
Muhammad Asfour Introduction
Control statements in Python differ slightly from control statements in languages such as Java, C#, and JavaScript.
Structure
The structure
Muhammad Asfour Strings in Python can be enclosed in either single or double quotes:
'Hello'
"Hello"
Concatenating strings can be done by using + operator:
greeting = "Go
Muhammad Asfour What boolean operators can be used in Python and how to use them?
Muhammad Asfour How do you declare a variable in Python? How do you check what the data type of the variable is?