100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Summary

Summary Think Python2 Chapter 5

Rating
-
Sold
-
Pages
7
Uploaded on
08-10-2018
Written in
2018/2019

This is the summary for YOU, if you want to learn the basics of Python quickly. Not everyone has time to read a book of more than 200 pages. That's why I thought, why don't I make a short summary of it! This is a summary of chapter 5 of the book ThinkPython2 (with the exercises!). I can't summarize this book in a day ofcourse so I will keep uploading summaries of the chapters. So don't worry the rest of the chapters will come.

Show more Read less
Institution
Course








Whoops! We can’t load your doc right now. Try again or contact support.

Connected book

Written for

Institution
Study
Course

Document information

Summarized whole book?
No
Which chapters are summarized?
Chapter 5
Uploaded on
October 8, 2018
Number of pages
7
Written in
2018/2019
Type
Summary

Subjects

Content preview

Chapter 5 Conditionals and recursion




The main topic of this chapter is the if statement, which executes different code depending on the
state of the program. But first two new operators are introduced: floor division and modulus.
5.1 Floor division and modulus
The floor division operator (//) divides 2 integers and round down to an integer. Suppose a movie
is 105 minutes. You want to know how many hours that is. A division returns a floating point:
>>> minutes = 105 1.75
>>> minutes / 60
But you want to know it in an integer. Floor division returns the hours in integer, rounding down:
>>> minutes = 105 1
>>> hours = minutes // 60
>>> hours
To get the remainder you use modulus (%) which divides 2 numbers and returns the remainder:
>>> remainder = minutes % 60 45
>>> remainder
You could also use this to check whether a number is divisible by another: if x % y is 0, then x is
divisible by y. Or you could extract the right most digit(s) from a number: x % 10 yields the right-
most digit of x (in base 10). Similarly x % 100 yields the last two digits.
5.2 Boolean expressions
$3.62
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached


Also available in package deal

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Yuna429 Hogeschool Rotterdam
Follow You need to be logged in order to follow users or courses
Sold
185
Member since
8 year
Number of followers
130
Documents
38
Last sold
11 months ago

Ik probeer zo goed mogelijk samenvattingen te maken. Hierbij kijk ik naar de informatie die in je boek staat, de opgaven en ik kijk af en toe op internet.

4.2

92 reviews

5
48
4
23
3
14
2
1
1
6

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions