Introduction to Programming Solutions

Solutions to selected exercises from Chap.  1 .

  • PDF / 14,857,266 Bytes
  • 169 Pages / 453.543 x 683.15 pts Page_size
  • 100 Downloads / 250 Views

DOWNLOAD

REPORT


The Python Workbook A Brief Introduction with Exercises and Solutions

The Python Workbook

Ben Stephenson

The Python Workbook A Brief Introduction with Exercises and Solutions

123

Ben Stephenson University of Calgary Calgary, AB Canada

ISBN 978-3-319-14239-5 DOI 10.1007/978-3-319-14240-1

ISBN 978-3-319-14240-1

(eBook)

Library of Congress Control Number: 2014957402 Springer Cham Heidelberg New York Dordrecht London © Springer International Publishing Switzerland 2014 This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use. The publisher, the authors and the editors are safe to assume that the advice and information in this book are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or the editors give a warranty, express or implied, with respect to the material contained herein or for any errors or omissions that may have been made. Printed on acid-free paper Springer International Publishing AG Switzerland is part of Springer Science+Business Media (www.springer.com)

To my son, Jonathan, who surprised us all by arriving before this book was completed, and to my wife Flora, for 12 fantastic years of marriage, and many more to come.

Preface

I believe that computer programming is a skill that is best learned through hands-on experience. While it is valuable for you to read about programming in textbooks and watch teachers create programs at the front of classrooms, it is even more important for you to spend time solving problems that allow you to put the ideas that you have been introduced to previously into practice. This book is designed to support and encourage hands-on learning about programming. It contains 174 exercises, spanning a variety of academic disciplines and everyday situations, which you can solve using only the material covered in most introductory Python programming courses. Each exercise that you complete will strengthen your understanding and enhance your ability to tackle subsequent programming challenges. I also hope that the connections that these exercises make to other academic disciplines and everyday life will keep you interested as you complete them. Solutions to approximately half of the exercises are provided in the second half of this book. Most of the solutions include brief annotations that explain the technique used to solve the problem, or highli