GithubHelp home page GithubHelp logo

apress / beginning-python-3ed Goto Github PK

View Code? Open in Web Editor NEW
213.0 24.0 178.0 548 KB

Source code for 'Beginning Python' by Magnus Lie Hetland

Home Page: http://www.apress.com/9781484200292

License: Other

Python 97.98% Java 0.13% C# 0.20% C 1.69%

beginning-python-3ed's Introduction

#Apress Source Code

This repository accompanies Beginning Python by Magnus Lie Hetland (Apress, 2017).

Cover image

Download the files as a zip using the green button, or clone the repository to your machine using Git.

##Releases

Release v1.0 corresponds to the code in the published book, without corrections or updates.

##Contributions

See the file Contributing.md for more information on how you can contribute to this repository.

beginning-python-3ed's People

Contributors

gwens avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

beginning-python-3ed's Issues

page 154 chapter 8

Since the program on page 151 is like so:

try: 
    x = int(input('Enter the first number: '))
    y = int(input('Enter the second number: '))
    print(x / y)
except ZeroDivisionError:
    print("The second number can't be zero!")

we will not get the :
TypeError: unsupported operand type(s) for /: 'int' and 'str'
if we give a "hello world!" as a 2nd number. Instead we will get that the typed input cannot be converted to int.
ValueError: invalid literal for int() with base 10: '"hello world!"

So the code on page 155 should be

try:
    x = int(input('Enter the first number: '))
    y = int(input('Enter the second number: '))
    print(x / y)
except ZeroDivisionError:
    print("The second number can't be zero!")
except ValueError:
    print("Are you sure you typed an integer?")

page 99 error (chapter 5 , just a small typo)

In the summary the line :
xrange([start,] stop[, step]) Creates an xrange object, used for iteration
should be :
range([start,] stop[, step]) Creates a range object, used for iteration

page 17 error

At the end of the page :
print("Hello, \ world!")
I am sure that the author wants to write :
print("Hello,
world!")

page 126 error (chapter 6)

That is an easy one:
`
>>> filter(lambda x: x.isalnum(), seq)

['foo', 'x41']
`

should be corrected to

`
>>> list(filter(lambda x: x.isalnum(), seq))

['foo', 'x41']
`

page 64 error (chapter 4)

x = {}
y = x
x['key'] = 'value'
y
{'key': 'value'}
x = {}
x = {} #### This is wrong!
{'key': 'value'}

The final line should be :

y
{'key': 'value'}

(e)Book errata

Somehow i couldn't find the errata link to the book, neither on Apress nor Springer, so i'm posting it here.
Maybe others will stumble upon it in search for answers (and/or maybe provide their findings).

Page 5 - Octal number literals: the book claims that octal number literals can be written as >>> 010. On execution, you will be presented with an SyntaxError: invalid token error.
PEP 3127 -- Integer Literal Support and Syntax from 2007-05-14 proposes that it should contain an additional o or O between the 0 and the octal number (similar to binary with 0b and hexadecimal with 0xprefix), therefore resulting in 0o10 or 0O10. This has been proposed for Python 3.0, and for backward compatibility, to Python 2.6.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.