0% found this document useful (0 votes)
63 views2 pages

Wiki - Week Zero - An Introduction To Interactive Programming in Python

This document provides an introduction to key concepts in interactive programming in Python including comments, strings, numbers, arithmetic expressions, operators, variables, and assignments. It explains that comments begin with # and describe program behavior, strings are sequences of characters enclosed in single or double quotes, there are two number types (integers and floats), arithmetic expressions combine numbers and operators using precedence rules, and variables are named using letters, numbers and underscores and assigned values using the = symbol.

Uploaded by

Vivek Singh
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
63 views2 pages

Wiki - Week Zero - An Introduction To Interactive Programming in Python

This document provides an introduction to key concepts in interactive programming in Python including comments, strings, numbers, arithmetic expressions, operators, variables, and assignments. It explains that comments begin with # and describe program behavior, strings are sequences of characters enclosed in single or double quotes, there are two number types (integers and floats), arithmetic expressions combine numbers and operators using precedence rules, and variables are named using letters, numbers and underscores and assigned values using the = symbol.

Uploaded by

Vivek Singh
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 2

10/05/2013

Wiki - Week zero | An Introduction to Interactive Programming in Python

Week zero
Comments CodeSkulptor Non-computational parts of the program that textually describe the behavior of the program. Comments begin with #, everything to right of the hash is ignored by Python. Comments should be frequent so you and others can understand the code. Lecture examples - CodeSkulptor More examples - Comments, Strings, and Print Strings CodeSkulptor Sequence of characters enclosed by a pair of single or double quotes Examples are " c a t sh a t ed o g s " and ' S t r i n g sa r ef u n ! '. Strings are one kind of data in Python. Their data type is denoted s t r. Lecture examples - Hello World More examples - Comments, Strings, and Print Numbers Arithmetic Expressions There are two kinds of numerical data in Python: integers and decimal numbers. Integers correspond to the data type i n t. Decimal numbers are represented by floating-point numbers corresponding to the data type f l o a t. Floating-point numbers have around 15 decimal digits of accuracy. In CodeSkulptor, all numbers (even integers) are represented internally as floating-point numbers. Lecture examples - Arithmetic Expressions More examples - Floats and Ints Arithmetic Operators Arithmetic Expressions Five basic arithmetic operators; addition ( +), subtraction ( -), multiplication ( *), division ( /) and exponentiation ( * *) In CodeSkulptor, the division operator ( /) returns a floating point approximation to the exact answer (as in Python 3 and Javascript). This answer differs from Python 2.6 where the division operator ( /) computes integer division (the floor of exact division). The integer division operator is / / in all versions of Python. Lecture examples - Arithmetic Expressions More examples - Arithmetic Operations, Division Arithmetic Expressions Arithmetic Expressions An arithmetic expression is either a number or an operator applied to two arithmetic expressions. Arithmetic expressions are entered as a sequence of numbers and arithmetic operators. Expressions are formed by grouping operators and operands via precedence: "Please excuse my dear Aunt Sallie"; parentheses, exponentiation, multiplication, division, addition, subtraction. Lecture examples - Arithmetic Expressions
https://class.coursera.org/interactivepython-002/wiki/view?page=week0 1/2

10/05/2013

Wiki - Week zero | An Introduction to Interactive Programming in Python

More examples - Order of Operations for Arithmetic Expressions, Possible Errors for Arithmetic Expressions Variables Variables Variable names consist of a sequence of letters, number and underscores ( _). Variable names start with a letter or underscore and are case sensitive. Single equals ( =) is used for assignment to variables. Double equals ( = =) is used for testing equality. Lecture examples - Variables More examples - Variable Naming, Vabiable Assignment, Variable Operations, Formulas

Created Wed 20 Mar 2013 11:20 AM PDT -0700 Last Modified Wed 20 Mar 2013 11:21 AM PDT -0700

https://class.coursera.org/interactivepython-002/wiki/view?page=week0

2/2

You might also like