Please enable JavaScript.
Coggle requires JavaScript to display documents.
PYTHON - Coggle Diagram
PYTHON
Started
-
Variable
-
-
-
-
-
Global Variable
If we use the global keyword, the variable belongs to the global scope
Variables that are created outside of a function (as in all of the examples in the previous pages) are known as global variables.
casting
If we want to specify the data type of a variable, this can be done with casting.
-
rule
-
-
A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
Variable names are case-sensitive (age, Age and AGE are three different variables)
-
Local Variable
If we create a variable inside a function, this variable will be local, and can only be used inside the function.
To create a global variable inside a function, you can use the global keyword.
-
-
-
Python is a popular programming language. It was created by Guido van Rossum, and released in 1991
Python used for :
- web development (server-side),
- software development
- mathematics
- system scripting.
-
String
-
-
-
check string
To check if a certain phrase or character is present in a string, we can use the keyword in.
Slicing
Specify the start index and the end index, separated by a colon, to return a part of the string.
b = "Hello, World!
print(b[2:5])
Escape character
To fix this problem, use the escape character \"
-
Control Flow
If
Statemen if digunakan untuk mengecek kondisi: jika kondisi if bernilai benar, maka kita akan menjalankan satu blok statemen (disebut if-block), jika tidak akan diteruskan dengan statemen else
For
tatemen perulangan for ... in ... merupakan statemen perulangan selain while. Statemen ini melakukan iterasi dari rangkaian obyek, berjalan melalui tiap item yang ada pada rangkaian / sequence. Apa itu rangkaian / sequence? rangkaian yaitu koleksi item yang terurut.
While
Statemen while merupakan statemen untuk perulangan, block kode akan dijalankan terus menerus selama kondisi benar. Statemen while dapat mempunyai bagian else (opsional).
-
-
-