We'll be using the Pycharm IDE this year.
Also new is that we'll be using Python 3.x (last year we used 2.7.x). The main differences you'll notice:
1. all print statements must be contained in( ).
- to display multiple lines of text you can use triple quotes, be careful of
spacing on individual lines as they will be displayed also.
input:
1. print ('''Hello
2. World!''')
output:
Hello
World!
2. integer division returns a float in 3.x (you can still use the previous convention
if preferred)
>>> 3/2
1.5
>>> 3/2.0
1.5
if you want just the integer portion of the quotient use //
>>> 3//2
1
>>> 3//2.0
1.5
3. user input is accepted only using the input() function (raw_input()is no
longer available) and the input type is always a string. You must change the
data type to the one desired, if other than string.
4. some common functions and methods that returned lists now return an
iterable object.
>>>range(3)
range(0, 3) #not [0, 1, 2] as in Python 2.7
>>>type(range(3))
<class 'range'>
>>>list(range(3)) #change the type, if needed
[0, 1, 2]
other methods that you would be familiar with are the dictionary methods
.keys(), .value(), and .items()
5. decimals are rounded to the nearest even number
>>>round(15.5)
16
>>>round(16.5)
16
Exercise 1.1 (Input, Expressions, Operators)
Exercise 1.2 (Conditionals)
Exercise 1.3 (for/while Loops)