Python Crash Course: A Hands-On, Project-Based Introduction to Programming
Rate it:
5%
Flag icon
language will bring you luck.
5%
Flag icon
In Python, you can write the Hello World program in one line: print("Hello world!") Such a simple program
5%
Flag icon
$ python
5%
Flag icon
$ python3
5%
Flag icon
Installing a Text Editor Geany
5%
Flag icon
Geany is configured to use the correct version.
5%
Flag icon
Build ▸ Set Build Commands.
5%
Flag icon
python3 -m py_compile "%f"
5%
Flag icon
python3 "%f"
5%
Flag icon
line in the terminal session:
6%
Flag icon
Python on Windows
6%
Flag icon
entering command into the Start
6%
Flag icon
enter python in lowercase.
6%
Flag icon
Python 3 button, which should automatically start downloading the correct installer for your system.
6%
Flag icon
Starting a Python Terminal Session
6%
Flag icon
C:\> C:\Python35\python
6%
Flag icon
Running Python in a Terminal Session
6%
Flag icon
Installing a Text Editor Geany is a simple text editor: it’s easy to install,
6%
Flag icon
1.25_setup.exe installer
6%
Flag icon
Configuring Geany
6%
Flag icon
C:\Python35\python -m py_compile "%f" Your path might be a little different,
7%
Flag icon
Running Python Programs from a Terminal Most of the programs you write in your text editor you’ll run directly from the editor, but sometimes it’s useful to run programs from a terminal instead.
7%
Flag icon
On Windows
7%
Flag icon
➊ C:\> cd Desktop\python_work
7%
Flag icon
python_work ➋ C:\Desktop\python_work> dir
7%
Flag icon
hello_world.py ➌ C:\Desktop\python_work> pytho...
This highlight has been truncated due to consecutive passage length restrictions.
7%
Flag icon
a variable named message.
7%
Flag icon
message = "Hello Python Crash Course world!"
7%
Flag icon
Naming and Using Variables
8%
Flag icon
Strings
8%
Flag icon
"This is a string."
8%
Flag icon
'This is also a string.'
8%
Flag icon
print(name.title())
8%
Flag icon
Ada Lovelace
8%
Flag icon
variable name. The method title() appears after the variable in the print() statement. A method is an action that Python can perform on a piece of data.
8%
Flag icon
Every method is followed by a set of parentheses, because methods often need additional information to do their work. That information is provided inside the parentheses. The title() function doesn’t need
11%
Flag icon
when you want to delete an item from a list and not use that item in any way, use the del statement;
11%
Flag icon
you remove it, use the pop() method.
11%
Flag icon
The remove() method deletes only the first occurrence of the value you specify.
11%
Flag icon
sort() Method
12%
Flag icon
len() function.
12%
Flag icon
use a for loop to print
12%
Flag icon
for magician in magicians:
13%
Flag icon
for loops that you can choose any name you want for the temporary variable that holds each value in the list.
13%
Flag icon
for item in list_of_items:
13%
Flag icon
Every indented line following the line for magician in magicians is considered inside the loop, and each indented line is executed once for each value in the list.
13%
Flag icon
Python uses indentation to determine when one line of code is connected to the line above
13%
Flag icon
Basically, it uses whitespace to force you to write neatly formatted code
13%
Flag icon
Forgetting the Colon
13%
Flag icon
The colon at the end of a for statement tells Python to interpret the next line as the start of a loop.
« Prev 1 3 6