Author Archives: Pacok27

Mastery09

  • Basic types and their use in Python

The basic types of variables are:

Char: Used to write just one letter. (a)

String: Used to write text. (hello world)

Int: used to assign numbers. (3, 3, 33 , 2223, -1)

Float: Used to assign decimal numbers. (3.33 34343.32 2.2451)

Mastery09

Mastery11

  • Calling Python functions

To call a function in  Python, after you define your function you write “exampleoffunction()” , that way python knows that it will have to bring the function.

For example, in this program I defined the function suma, and then I call it writting “suma()”.

Mastery11

Mastery11

Mastery08

  1. Python conventions (Zen of Python)

Write in the terminal python, and then “import this”.

Mastery08

Mastery08

Mastery06

  1. Install Linux on their own computerMastery06

Mastery06

Mastery10

  1. Basic output (print) in Python

To print text in python, you must write ‘print (“text text text”)’ and that’s it.

Mastery10

Mastery10

WSQ08

WSQ08

WSQ08

WSQO7

Don’t know why this one took me so long…

WSQO7

WSQO7

Mastery19

Use of loops with “while”

Using a while in python is simple, very similar to an if. Only write “while (condition):”, and remember to leave a space under the while. and the end of the loop define the variable that will be used in the while.

Mastery19

Mastery19

Mastery16

Use of “else” with a conditional

Using an else in python is very similar to using an if.

Continuing with the program created in Mastery15, If the condition is not true in the if, python will jump to the else. to write and else just put “else :” and then (after leaving a space) write what you want the program to do.Mastery16

Mastery16

Mastery15

Use of the conditional “if”

To use an if, you’ll have to write “if (‘comparison’):” and then you write the rest. Don’t forget to leave a space for python to know that what you are writting next is part of the conditional.

Mastery15

Mastery15