Commands | |||
---|---|---|---|
Command | Example | Description | |
Command Line | |||
~ | cd ~/ | shortcut for home directory | |
.. | cd ../ | short cut for a directory one level higher | |
pwd | shows where you are, prints the current directory | ||
ls | lists the files contained in the current/working directory | ||
cd | cd ~/ public_html | changes the working directory | |
clear | shifts all of the commands up so that the window appears "cleared" | ||
mkdir | mkdir public_html | makes a directory | |
gedit | gedit html.txt | makes a txt file | |
rm | rm html.txt | permanently removes a file | |
rmdir | rmdir public_html | removes an EMPTY directory | |
mv | mv ~/ public_html/ html.txt ~/ Desktop/ | moves a file from on directory to another | |
HTML **Always use the greaterthan less than signs, I'm using brackets because the signs won't show up since I'm using html! **You can nest tags! |
|||
<html> | <html> all text </html> | You just need to place all text within HTML tags | |
<head> | <head> text </head> | Anything you need for the webpage but not the body go here (title displayed on tab, etc.) | |
<body> | <body> text </body> | Anything displayed in the body go within these tags. | |
<title> | <title> word </title> | This the title displayed to name the page, this page is called Exam 1 Study Guide. | |
<b> | <b> word <b> = word |
bold | |
<i> | <i> word <i> = word |
italicize | |
<center> | <cemter> word <center> = |
centers text within | |
<h1> | <h1> word <h1> = word |
heading (formatted with a line break before and after, so you don't have to
<br> yourself). There are 6 headings: h1-h6. Each is a subheading to the previous, with h1 being the biggest heading. |
|
<br> | Lalala I want to write on a new line <br> this is a new line = Lalala I want to write on a new line this is a new line |
line break (most commands need and open and closing tag, but this doesn't need a closing tag) | |
anchor <a> | <a href="http://www.google.com"> www.google.com </a> = www.google.com |
Add a link to your page! This tag needs an ATTRIBUTE to work. Without this attribute, href, only wwww.google.com will show but nothing will happen when you click it. Www.google.com is merely a title. |
|
<img> | <img src = "picture.jpg" alt = "Unavailable" width = "300" height = "300"> | Displays an image. For the src attribute, you have to add either an image from your computer or a picture link online. The alt attribute is optional, and displays your customized text when the image can't be displayed for some reason. The image size can be customized according to pixels (height and width), This tag does not need a closing tag. |
|
<table> | <table> table </table> | Makes a table | |
<td> | <td> data <td> | Td is one cell of a table. | |
<th> | <th> data title <th> | Th is one cell of a table that displays data within it as a heading or title; centers as well. | |
<tr> | <tr> <td></td><td></td> </tr> | Tr indicates how many cells are grouped together. When the tr ends and a new one begins, it makes a new row of cells. | |
An attribute for td and th is colspan="#", which makes one cell take up an indicated number of cells. This cell takes up 3. | |||
Python tabs are super important! |
|||
*, +, -, / | remember: 3/4 is 0, but 3.0/4 is 0.75 | simple arithmetic | |
and, or, not | booleans | ||
>, <, <=, >=, ==, != | Comparisons: you HAVE to use a double == for comparisons, because one = means a variable assignment. | ||
% | 8 % 5 = 3 | Modulo/Remainder | |
** | 3**2 = 9 | Exponents | |
" " | "hello" | string | |
Concatenation | "string" + "string" = "stringstring" | adds two strings together, if you want spaces in between you have
to add a space to the string "string " or add a "space": "string" + " ".
Can also multiply strings with numbers: "string" * 2 = "stringstring" |
|
def | def functionname (parameters, separate, with, commas): | define a function | |
print "boo" | prints variable values or strings, only what to display | ||
if, elif, else | if condition: result elif condition: result else: result |
Conditionals. If is always first. Elif is an intermediary for if and else. Must follow an if, and can have multiple. Only first time condition is evaluated. Else must also follow an if, does not have a condition, only runs if "if" is false. |