Skip to content

Latest commit

 

History

History
91 lines (72 loc) · 1.69 KB

2_variables.md

File metadata and controls

91 lines (72 loc) · 1.69 KB

Variables

  • Its similar to javascript

Lets start, to test it, launch the server python on the VS terminal:

  • type python there

🔴 DONT

// ✋ DONT start the variables with numbers:
0001name = "Dave";
// you will get an error telling you that "leading zeros in decimal integer are not permitted"
// SAME for this
1name = "Dave";
//
// ✋ EXCLAMATION isnt allowed either
name! = "Dave"
//  ✋ hyphen / minus isnt allowed either
name-first = "Dave"
//  ✅ use underscores
name_one = "Dave"
//  ✅ use numbers at the end of the variable
name001 = "Dave"


Expression vs Statements

//  to test it, launch the server python on the VS terminal: type python
// examples of expressions
2 + 2;
// result
4;
//
//  if you write the below, its also an expression
("Expression");
//  result
("Expression");
//
//
// type the below,  press enter
myname = "mel";
//result:
myname;
// press enter again
("mel"); // result
//  Type quit() to leave


other statement

  • At the top right of the file you will be working, you have an arrow, once we are done with the code below, unfold the arrow and choose "run python file"
## shift + alt d to dupli
## 20 asterisks
line01= "********************"
# remove all of the arterisk from the line02, leave only 2 asterisks
line02= "*                  *"
#  on the line03 , do the same, leave 2 sterisks and count 12345 then write welcome, count 12345 again
line03= "*      WELCOME     "



print("")
print(line01)
print(line02)
print(line03)
print(line02)
print(line01)

result

********************
*                  *
*      WELCOME
*                  *
********************