Tutor profile: Kavita K.
Subject: Python Programming
What is the difference between local and global variables in Python?
Variables that are declared outside a function are known as global variables. Global variables are accessible anywhere in the code, even inside functions. Local variables are variables that are declared inside functions. That is, they are local to the function and cannot be accessed outside the function. Think of the global area as the parent and the local area as a child. Children inherit properties (variables) from their parents but parents cannot use properties (variables) from a child. Example: In the following code, variable1 = "I am a global variable" def function(): variable2 = "I am inside the function so I am a local variable" Variable 1 is global, and Variable 2 is local to the function. Variable 1 can be used inside the function as it is global, however, variable 2 cannot be used outside of the function.
== is the comparison operator. It is used to simply compare two values WITHOUT considering their datatype. For example, 5 == '5' will evaluate to true even though one of them is a number and one is a string. === is the equality operator. It compares values as well as datatypes. For example, 5 === '5' will evaluate to false since they are different datatypes. 5 === 5 will evaluate to true since the datatype as well as the value is the same.
Subject: HTML5 Programming
What is the difference between <ol>, <ul>, and <li>?
<ol> is used to create an ordered list. An ordered list is one in which list items are denoted by numbers. <ul> is used to create unordered lists. Unordered lists are lists in which items are denoted by bullet points. <li> is used to list out each item in either of the above lists. For example, if you wanted to create an ordered list with your top 3 favorite colors, you would write: <ol> <li> Blue </li> <li> Black </li> <li> White </li> </ol> The list would come out looking like: 1. Blue 2. Black 3. White If you wanted to create an unordered list with your favorite foods, you would write: <ul> <li> Pizza </li> <li> Pasta </li> <li> Broccoli </li> </ul> The list would come out looking like: (with bullet points) o Pizza o Pasta o Broccoli
needs and Kavita will reply soon.