You should read Chapter 1, Introduction to Computers and Programming, from our textbook, Starting Out with Python, before next week's class.
Remember, homework 1 is due this Sunday by 11:59 PM.
You will find it here.
#include <stdio.h> main() { printf("Hello, world!\n"); }
$ gcc -o hello hello.c
$ ./hello Hello, world!
python3
on the Unix command line and hit Enter you will be running Python in
interactive mode
$ python3 Python 3.5.1 (v3.5.1:37a07cee5969, Dec 5 2015, 21:12:44) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>>
python3
, not python
python
you will be using the wrong version of Pythonhelp()
will get you started
>>> help() Welcome to Python 3.5's help utility! If this is your first time using Python, you should definitely check out the tutorial on the Internet at http://docs.python.org/3.5/tutorial/. Enter the name of any module, keyword, or topic to get help on writing Python programs and using Python modules. To quit this help utility and return to the interpreter, just type "quit". To get a list of available modules, keywords, symbols, or topics, type "modules", "keywords", "symbols", or "topics". Each module also comes with a one-line summary of what it does; to list the modules whose name or summary contain a given string such as "spam", type "modules spam". help>
help()
with no arguments, puts you in help modehelp> topics Here is a list of available topics. Enter any topic name to get more help. ASSERTION DELETION LOOPING SHIFTING ASSIGNMENT DICTIONARIES MAPPINGMETHODS SLICINGS ATTRIBUTEMETHODS DICTIONARYLITERALS MAPPINGS SPECIALATTRIBUTES ATTRIBUTES DYNAMICFEATURES METHODS SPECIALIDENTIFIERS AUGMENTEDASSIGNMENT ELLIPSIS MODULES SPECIALMETHODS BASICMETHODS EXCEPTIONS NAMESPACES STRINGMETHODS BINARY EXECUTION NONE STRINGS BITWISE EXPRESSIONS NUMBERMETHODS SUBSCRIPTS BOOLEAN FLOAT NUMBERS TRACEBACKS CALLABLEMETHODS FORMATTING OBJECTS TRUTHVALUE CALLS FRAMEOBJECTS OPERATORS TUPLELITERALS CLASSES FRAMES PACKAGES TUPLES CODEOBJECTS FUNCTIONS POWER TYPEOBJECTS COMPARISON IDENTIFIERS PRECEDENCE TYPES COMPLEX IMPORTING PRIVATENAMES UNARY CONDITIONAL INTEGER RETURNING UNICODE CONTEXTMANAGERS LISTLITERALS SCOPING CONVERSIONS LISTS SEQUENCEMETHODS DEBUGGING LITERALS SEQUENCES help>
help> q You are now leaving help and returning to the Python interpreter. If you want to ask for help on a particular object directly from the interpreter, you can type "help(object)". Executing "help('string')" has the same effect as typing a particular string at the help> prompt. >>>
>>> 5 + 6 11 >>> 6 - 5 1 >>> 3 * 5 15 >>> 4.1 / 2 2.05
>>> print("Hello world!") Hello world!
>>> a = 5 >>> b = 6 >>> a * b 30 >>> a - b -1
>>> a $ b
File "<stdin>", line 1
a $ b
^
SyntaxError: invalid syntax
exit()
print("Hello world!")
$ python3 hello.py Hello world!
>>> a = 5 >>> a 5
$ cat var_test.py #! /usr/bin/python3 a = 5 a $ ./var_test.py $