Uploaded by rachellehammoud6

Coding Extra Notes

advertisement
Coding Extra Notes:
 To see the result of an expression or a string in the console we use print(“ ”)
 To find the sum or difference:
-We assign variables then write an expression. Then we print the expression.
- Example:
X= 2
Y= 4
Z= x-y
Print(z)





Anything written in letters must be within quotation marks for it to be printed or assigned
a variable. Usually, the quotations makes anything into a string.
-Example:
X=” CSC”
Print (“Hello World!”)
Y= “2023”
To add space between the words we use:
Print (“Hello , World!)”
To write the words on a different line we use:
Print(“Hello\nWorld!)
To have an output repeated several times:
We assign a string and an integer. Then we write an expression multiplying them
together. Then we print the expression. In the console we will see the output repeated
-Example:
Input: S=Hello
N=3
R=S*N
Print(R)
Output: HelloHelloHello
Escape Sequence
Meaning
\n
New line
\t
Tab
\’
‘
\”
“
\\
\
Download