Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Mar 1, 2020. It is now read-only.

Commit 1d3e557

Browse files
Added addition info to the cheatsheet
1 parent 0523492 commit 1d3e557

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

‎README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,20 @@ python <script name>
1111

1212
Replace "<script name>" with the file name of the Python script that you want to run.
1313

14+
## Declare Variables
15+
16+
Variables hold the values that are used in your application or script. In Python,
17+
variables are not strong-typed. This means that the variables you declare,
18+
are not limited to a particular data type. However, the variable does have a
19+
value, any future changes to that value must be of the same type. So you cannot set
20+
the value of a variable to a string and then change it to a integer.
21+
22+
```
23+
myVariable = "red"
24+
myOtherVariable = false
25+
myOtherOtherVariable = 5
26+
```
27+
1428
## Functions
1529

1630
To write a function in Python, you start the function out with the "def" keyword.
@@ -23,6 +37,10 @@ def myFunction (param1, param2, param3):
2337
return sum
2438
```
2539

40+
If you notice, there are no braces or brackets around the contents of the function.
41+
Python relies on indentation for the grouping of lines together within a given
42+
section.
43+
2644
## Random Number
2745

2846
Random nubmers can be used to do countdowns or other things that are needed.
@@ -45,7 +63,6 @@ In the example above, 5 is the lower limit of the range and 60 is the upper limi
4563
of the range. If your range needs to be different, then changes either or both of
4664
these values.
4765

48-
4966
## More Resources
5067

5168
The Raspberry Pi traffic light project is written in Python code. You can review the

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /