The Path To Discover Excellence.

Monday, 26 October 2020

October 26, 2020

First Programming Concepts Cheat Sheet


First Programming Concepts Cheat Sheet

Functions and Keywords

Functions and keywords are the building blocks of a language’s syntax.

Functions are pieces of code that perform a unit of work. In the examples we've seen so far, we've only encountered the print() function, which prints a message to the screen. We'll learn about a lot of other functions in later lessons but, if you're too curious to wait until then, you can discover all the functions available here.

Keywords are reserved words that are used to construct instructions. We briefly encountered for and in in our first Python example, and we'll use a bunch of other keywords as we go through the course. For reference, these are all the reserved keywords:


You don't need to learn this list; we'll dive into each keyword as we encounter them. In the meantime, you can see examples of keyword usage here.

Arithmetic operators

Python can operate with numbers using the usual mathematical operators, and some special operators, too. These are all of them (we'll explore the last two in later videos).

  • a + b = Adds a and b
  • a - b = Subtracts b from a
  • a * b = Multiplies a and b
  • a / b = Divides a by b
  • a ** b = Elevates a to the power of b. For non-integer values of b, this becomes a root (i.e. a**(1/2) is the square root of a)
  • a // b = The integer part of the integer division of a by b
  • a % b = The remainder part of the integer division of a by b
October 26, 2020

What is Programming?

Programming is, quite literally, all around us. From the take-out we order to the movies we stream, code enables everyday actions in our lives. Tech companies are no longer recognizable as just software companies — instead, they bring food to our door, help us get a taxi, influence outcomes in presidential elections, or act as a personal trainer.

When you’re walking down the street, where can you find technology in your environment? Click on the white circles.


For many years, only a few people have known how to code. However, that’s starting to change. The number of people learning to code is increasing year by year, with estimates of around 22.3 million software developers worldwide, which doesn’t even account for the many OTHER careers that relate to programming.

Here at Codecademy, our mission is to make technical knowledge accessible and applicable. Technology plays a crucial role in our economy — but programming is no longer just for software engineers. Any person can benefit from learning to program — whether it’s learning HTML to improve your marketing emails or taking a SQL course to add a dose of analysis to your research role.

Even outside of the tech industry, learning to program is essential to participating in the world around you: it affects the products you buy, the legal policies you vote for, and the data you share online.

So, let’s dig into what programming is.


Put simply, programming is giving a set of instructions to a computer to execute. If you’ve ever cooked using a recipe before, you can think of yourself as the computer and the recipe’s author as a programmer. The recipe author provides you with a set of instructions that you read and then follow. The more complex the instructions, the more complex the result!

How good are you at giving instructions? Try and get Codey to draw a square!


“Ok, so now I know what programming is, but what’s coding? I’m here to learn how to code. Are they the same thing?”

While sometimes used interchangeably, programming and coding actually have different definitions.

  • Programming is the mental process of thinking up instructions to give to a machine (like a computer).
  • Coding is the process of transforming those ideas into a written language that a computer can understand.

Over the past century, humans have been trying to figure out how to best communicate with computers through different programming languages. Programming has evolved from punch cards with rows of numbers that a machine read, to drag-and-drop interfaces that increase programming speed, with lots of other methods in between.

pictures of different punchcards


To this day, people are still developing programming languages, trying to improve our programming efficiency. Others are building new languages that improve accessibility to learning to code, like developing an Arabic programming language or improving access for the blind and visually impaired.


“The problem with programming is not that the computer isn’t logical—the computer is terribly logical, relentlessly literal-minded.”

Ellen Ullman, Life in Code

When we give instructions to a computer through code, we are, in our own way, communicating with the computer. But since computers are built differently than we are, we have to translate our instructions in a way that computers will understand.

Computers interpret instructions in a very literal manner, so we have to be very specific in how we program them. Think about instructing someone to walk. If you start by telling them, “Put your foot in front of yourself,” do they know what a foot is? Or what front means? (and now we understand why it’s taken so long to develop bipedal robots…). In coding, that could mean making sure that small things like punctuation and spelling are correct. Many tears have been shed over a missing semicolon (;) a symbol that a lot of programming languages used to denote the end of a line.

But rather than think of this as a boss-employee relationship, it’s more helpful to think about our relationship with computers as a collaboration.

The computer is just one (particularly powerful) tool in a long list of tools that humans have used to extend and augment their ability.

As mentioned before, computers are very good at certain things and well, not so good at others. But here’s the good news: the things that computers are good at, humans suck at, and the things that computers suck at, humans are good at! Take a look at this handy table:

table comparing human and computer abilities

Just imagine what we can accomplish when we work together! We can make movies with incredible special effects, have continuous 24/7 factory production, and improve our cities and health.

picture of a robot-human


The best computer programs are the ones that enable us to make things that we couldn’t do on our own, but leverage our creative capacities. We may be good at drawing, but a computer is great at doing the same task repeatedly — and quickly!


As programming becomes a larger part of our lives, it’s vital that everyone has an understanding of what programming is and how it can be used. Programming is important to our careers, but it also plays a key role in how we participate in politics, how we buy things, and how we stay in touch with one another.

Learning to code is an exciting journey. Whether your goal is to build a mobile app, search a database, or program a robot, coding is a skill that will take you far in life. Just remember — computers are tools. While learning to the program may initially be frustrating, if you choose to stick with it, you’ll be able to make some brilliant things.


Wednesday, 22 July 2020

July 22, 2020

Learn C++ References & Pointers

const Reference

In C++, pass-by-reference with const can be used for a function where the parameter(s) won’t change inside the function.
This saves the computational cost of making a copy of the argument.

int triple(int const &i) { return i * 3; }


In C++, a pointer variable stores the memory address of something else. It is created using the * sign.

int* pointer = &gum;


In C++, a reference variable is an alias for another object. It is created using the & sign. Two things to note:
  1. Anything done to the reference also happens to the original.
  2. Aliases cannot be changed to alias something else.

int &sonny = songqiao;

Memory Address

In C++, the memory address is the location in the memory of an object. It can be accessed with the “address of” operator, &.
Given a variable porcupine_count, the memory address can be retrieved by printing out &porcupine_count. It will return something like: 0x7ffd7caa5b54.

std::cout << &porcupine_count << "\n";


In C++, a dereference reference operator*, can be used to obtain the value pointed to by a pointer variable.

int gum = 3; // * on left side is a pointer int* pointer = &gum; // * on right side is a dereference of that pointer int dereference = *pointer;


In C++, pass-by-reference refers to passing parameters to a function by using references.
It allows the ability to:
  • Modify the value of the function arguments.
  • Avoid making copies of a variable/object for performance reasons.

void swap_num(int &i, int &j) { int temp = i; i = j; j = temp; } int main() { int a = 100; int b = 200; swap_num(a, b); std::cout << "A is " << a << "\n"; std::cout << "B is " << b << "\n"; }

Thursday, 2 July 2020

July 02, 2020

Learn Python: Syntax


A comment is a piece of text within a program that is not executed. It can be used to provide additional information to aid in understanding the code.
The # character is used to start a comment and it continues until the end of the line.

# Comment on a single line user = "JDoe" # Comment after code

Arithmetic Operations

Python supports different types of arithmetic operations that can be performed on literal numbers, variables, or some combination. The primary arithmetic operators are:
  • + for addition
  • - for subtraction
  • * for multiplication
  • / for division
  • % for modulus (returns the remainder)
  • ** for exponentiation

# Arithmetic operations result = 10 + 30 result = 40 - 10 result = 50 * 5 result = 16 / 4 result = 25 % 2 result = 5 ** 3

Plus-Equals Operator +=

The plus-equals operator += provides a convenient way to add a value to an existing variable and assign the new value back to the same variable. In the case where the variable and the value are strings, this operator performs string concatenation instead of addition.
The operation is performed in-place, meaning that any other variable which points to the variable being updated will also be updated.

# Plus-Equal Operator counter = 0 counter += 10 # This is equivalent to counter = 0 counter = counter + 10 # The operator will also perform string concatenation message = "Part 1 of message " message += "Part 2 of message"


A variable is used to store data that will be used by the program. This data can be a number, a string, a Boolean, a list or some other data type. Every variable has a name which can consist of letters, numbers, and the underscore character _.
The equal sign = is used to assign a value to a variable. After the initial assignment is made, the value of a variable can be updated to new values as needed.

# These are all valid variable names and assignment user_name = "@sonnynomnom" user_id = 100 verified = False # A variable's value can be changed after assignment points = 100 points = 120

Modulo Operator %

A modulo calculation returns the remainder of a division between the first and second number. For example:
  • The result of the expression 4 % 2 would result in the value 0, because 4 is evenly divisible by 2 leaving no remainder.
  • The result of the expression 7 % 3 would return 1, because 7 is not evenly divisible by 3, leaving a remainder of 1.

# Modulo operations zero = 8 % 4 nonzero = 12 % 5


An integer is a number that can be written without a fractional part (no decimal). An integer can be a positive number, a negative number or the number 0 so long as there is no decimal portion.
The number 0 represents an integer value but the same number written as 0.0 would represent a floating point number.

# Example integer numbers chairs = 4 tables = 1 broken_chairs = -2 sofas = 0 # Non-integer numbers lights = 2.5 left_overs = 0.0

String Concatenation

Python supports the joining (concatenation) of strings together using the + operator. The + operator is also used for mathematical addition operations. If the parameters passed to the + operator are strings, then concatenation will be performed. If the parameter passed to + have different types, then Python will report an error condition. Multiple variables or literal strings can be joined together using the + operator.

# String concatenation first = "Hello " second = "World" result = first + second long_result = first + second + "!"


The Python interpreter will report errors present in your code. For most error cases, the interpreter will display the line of code where the error was detected and place a caret character ^ under the portion of the code where the error was detected.

if False ISNOTEQUAL True: ^ SyntaxError: invalid syntax


A ZeroDivisionError is reported by the Python interpreter when it detects a division operation is being performed and the denominator (bottom number) is 0. In mathematics, dividing a number by zero has no defined value, so Python treats this as an error condition and will report a ZeroDivisionError and display the line of code where the division occurred. This can also happen if a variable is used as the denominator and its value has been set to or changed to 0.

numerator = 100 denominator = 0 bad_results = numerator / denominator ZeroDivisionError: division by zero


A string is a sequence of characters (letters, numbers, whitespace or punctuation) enclosed by quotation marks. It can be enclosed using either the double quotation mark " or the single quotation mark '.
If a string has to be broken into multiple lines, the backslash character \ can be used to indicate that the string continues on the next line.

user = "User Full Name" game = 'Monopoly' longer = "This string is broken up \ over multiple lines"


A SyntaxError is reported by the Python interpreter when some portion of the code is incorrect. This can include misspelled keywords, missing or too many brackets or parenthesis, incorrect operators, missing or too many quotation marks, or other conditions.

age = 7 + 5 = 4 File "<stdin>", line 1 SyntaxError: can't assign to operator


A NameError is reported by the Python interpreter when it detects a variable that is unknown. This can occur when a variable is used before it has been assigned a value or if a variable name is spelled differently than the point at which it was defined. The Python interpreter will display the line of code where the NameError was detected and indicate which name it found that was not defined.

misspelled_variable_name NameError: name 'misspelled_variable_name' is not defined

Floating Point Numbers

Python variables can be assigned different types of data. One supported data type is the floating point number. A floating point number is a value that contains a decimal portion. It can be used to represent numbers that have fractional quantities. For example, a = 3/5 can not be represented as an integer, so the variable a is assigned a floating-point value of 0.6.

# Floating point numbers pi = 3.14159 meal_cost = 12.99 tip_percent = 0.20

  1. python class 11 notes pdf
  2. python class 11 sumita arora
  3. python class 11 sumita arora notes
  4. python class 11 book
  5. python class 11 ppt
  6. python class 11th
  7. python class 11 syllabus
  8. python class 11 programs
  9. python class 11 cbse
  10. python class 11 pdf download
  11. python class 11 assignment
  12. python class 11 question answers
  13. computer science with python class 11 answers
  14. class 11 python all programs
  15. about python class 11
  16. python for class 11
  17. python for class 11 cbse
  18. python for class 11 cbse pdf
  19. python for class 11th
  20. python for class 11 ip
  21. python for class 11th cbse
  22. notes of python class 11
  23. solution of python class 11
  24. python class 11 boolean logic
  25. python cbse class 11 book
  26. python cbse class 11 book pdf
  27. python ncert class 11 book
  28. python class 11 question bank
  29. python class 11 practical book solutions
  30. class 11 python book pdf download
  31. python class 11 cbse notes
  32. python class 11 cbse informatics practices
  33. python class 11 computer science
  34. python class 11 cbse syllabus
  35. python class 11 cbse book pdf
  36. python class 11 cbse tutorial
  37. python class 11 cbse notes pdf
  38. cs with python class 11
  39. ncert python class 11 pdf download
  40. computer science with python class 11 dhanpat rai publications
  41. dictionary python class 11
  42. computer science with python class 11 download
  43. data handling python class 11
  44. debugging in python class 11
  45. dictionaries in python class 11 notes
  46. python class 11 exercise
  47. computer science with python class 11 book
  48. python program examples class 11
  49. python e book for class 11 cbse
  50. python fundamentals class 11 notes
  51. python fundamentals class 11
  52. python fundamentals class 11 solutions
  53. python fundamentals class 11 pdf
  54. python fundamentals class 11 ppt
  55. getting started with python class 11 notes
  56. getting started with python class 11
  57. getting started with python class 11 solutions
  58. getting started with python class 11 pdf
  59. getting started with python class 11 notes pdf
  60. getting started with python class 11 cbse
  61. python class 11 half yearly paper
  62. python class 11 sample paper half yearly
  63. class 11 python half yearly question paper
  64. text handling in python class 11
  65. how to study python class 11
  66. data handling in python class 11 notes
  67. python tutorial in hindi class 11
  68. python class 11 ip
  69. python class 11 important questions
  70. python class 11 important programs
  71. python class 11 ip sample paper
  72. python trends class 11 ip
  73. python notes class 11 ip
  74. python class 11 notes pdf ip
  75. ip python class 11
  76. ip python class 11 notes
  77. ip python class 11 syllabus
  78. ip python class 11 pdf
  79. ip python class 11 sample paper
  80. ip python class 11 solutions
  81. ip python class 11 project
  82. ncert ip python class 11
  83. python class 11 kv notes
  84. python class 11 kvs
  85. class 11 python notes kvs
  86. kv planner python class 11
  87. learn python class 11
  88. python language class 11
  89. class 11 python looping
  90. class 11 python lab manual
  91. list in python class 11
  92. python language for class 11 cbse
  93. list manipulation in python class 11
  94. python class 11 study material
  95. python modules class 11
  96. python.mykvs class 11
  97. python mcq class 11
  98. class 11 ip
  99. string manipulation in python class 11
  100. python class 11 ncert
  101. python class 11 ncert solutions
  102. python class 11 notes cbse
  103. python class 11 notes ip
  104. cs python class 11 notes
  105. python class 11 output questions
  106. python of class 11
  107. python of class 11 cbse
  108. syllabus of python class 11
  109. pdf of python class 11
  110. features of python class 11
  111. python class 11 pdf
  112. python class 11 preeti arora
  113. python class 11 preeti arora pdf
  114. python class 11 practical questions
  115. python class 11 project
  116. python class 11 practical
  117. python class 11 questions
  118. python class 11 question paper
  119. python class 11 cbse question papers
  120. python class 11 cbse questions
  121. python class 11 sample question paper
  122. data representation in python class 11
  123. python class 11 solutions
  124. python class 11 sultan chand
  125. python class 11 sumita arora solutions
  126. python class 11 sample paper
  127. python class 11 sumita arora solutions pdf
  128. python class 11 textbook pdf
  129. python class 11 textbook
  130. python class 11 tutorial
  131. python class 11 test
  132. python class 11 cbse textbook
  133. python trends class 11
  134. understanding sorting in python class 11
  135. understanding sorting in python class 11 notes
  136. python class 11 viva questions
  137. python version for class 11 cbse
  138. python programs for class 11 with output
  139. python worksheet class 11
  140. ip with python class 11
  141. ip python question paper class 11 with solution
  142. python trends wordpress class 11
  143. computer with python class 11
  144. what is python class 11
  145. together with python class 11
  146. ip with python class 11 sample paper
  147. cs with python class 11 solutions
  148. together with python class 11 pdf
  149. ip with python class 11 solutions
  150. python class 11 chapter 1
  151. python class 11 chapter 1 notes
  152. python ch 1 class 11
  153. computer science with python class 11 chapter 1
  154. computer science with python class 11 chapter 1 notes
  155. python chapter 1 class 11
  156. python sample paper class 11 2020
  157. class 11 python chapter 2 solutions
  158. 20 python programs class 11
  159. python chapter 4 class 11
  160. python fundamentals class 11 chapter 6

print() Function

The print() function is used to output text, numbers, or other printable information to the console.
It takes one or more arguments and will output each of the arguments to the console separated by a space. If no arguments are provided, the print() function will output a blank line.

print("Hello World!") print(100) pi = 3.14159 print(pi)