[closed] Homework 3.5 Lists of lists

In the description of the problem there's an L at the end of the total tuition in this example. Is it just a typo?

#>>> print total__enrollment(usa_univs)
#(77285,3058581079L)

asked 08 Mar '12, 16:09

sheelagh's gravatar image

sheelagh
414
accept rate: 0%

closed 08 Mar '12, 16:17

The question has been closed for the following reason "The question is answered, right answer was accepted - Thanks" by sheelagh 08 Mar '12, 16:17


3 Answers:

The standard type for a simple number is an integer. When the number is too big for an integer, it is automatically converted into a long. Here is the Python documentation on longs.

link

answered 08 Mar '12, 16:14

Mark%20Brownstein's gravatar image

Mark Brownstein
3.1k92267

The number is larger than the python interpreter can process. If your answer is correct, you'll see that it produces the same result.

link

answered 08 Mar '12, 16:10

David%20Harris's gravatar image

David Harris
8.1k2155111

edited 08 Mar '12, 16:10

Follow-up question: I get the exact same number but no long when I print the output.

Edit: nvm, long is added when using return.

(08 Mar '12, 16:20) Arik Beremzon Arik%20Beremzon's gravatar image

It is because the number is to big for a regular integer, the L denotes a Long.
See this link in the python reference

link

answered 08 Mar '12, 16:13

Marc-Andre%20Perreault's gravatar image

Marc-Andre P...
8717

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×15,217
×1,718
×10

Asked: 08 Mar '12, 16:09

Seen: 121 times

Last updated: 08 Mar '12, 16:21