Coder Social home page Coder Social logo

swaroopch / byte-of-python Goto Github PK

View Code? Open in Web Editor NEW
2.3K 2.3K 1.1K 6.14 MB

Beginners book on Python - start here if you don't know programming

Home Page: https://python.swaroopch.com/

Python 98.92% Makefile 1.08%
beginner-friendly book python tutorial

byte-of-python's People

Contributors

amarouter avatar amio avatar archerimagine avatar bborysenko avatar borisliu avatar brokenthorn avatar coffeeofmorpheus avatar d-s-1 avatar dbojan avatar ferrisvienna avatar gilianhuber avatar jahangir-sh avatar jooola avatar k-guan avatar kamikat avatar keithdotpower avatar lambda-abstraction avatar lengyueyang avatar mattiasduerrmeier avatar maxzheng avatar msiism avatar myd7349 avatar nanxiao avatar romain-gilliotte avatar rootulp avatar seanchao avatar swaroopch avatar techgaun avatar wind2esg 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  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

byte-of-python's Issues

is '>a1b2_c3' a valid variable name?

In 06-basics.pd it said:

Examples of valid identifier names are i, __my_name, name_23, >a1b2_c3.

However, when I define the variable >a1b2_c3, the python(3.2.3) interpreter just complained

SyntaxError: invalid syntax

So,

  • The first character of the identifier must be a letter of the alphabet (uppercase ASCII or lowercase ASCII or Unicode character) or an underscore ('_').

Is it correct?

Thanks for attentions :)

Asciidoc Syntax Fix

basics.md Line 310:

Similarly, we assign the literal string to the variable +s+ and then print it.

op_exp.md Line 197:

We store the result of the expression `length * breadth` in the variable +area+ and then print it using the +print+ function.

control_flow.md Line 22:

 We set the variable +number+ to any integer we want,

My fork is working for translating BoP so I can't make a pull request. Please bear with me. :)

op_exp.md

// (divide and floor)

Divide x by y and round the answer down to# the nearest whole number
13 // 3 gives 4
-13 // 3 gives -5

the nearest whole number??

print(9/1.81)
4.972375690607735

print(9//1.81)
4.0

C/C --> C/C++

page 61
In C/C, if you want to write `for (int i = 0; i < 5; i)
In C/C++

Statement Missing in Control Flow Chapter

In Control Flow chapter, The for Loop section, the Example's explain, there is a line as:

Remember that the else part is optional. When included, it is always executed once after the for loop is over unless a <> statement is encountered.

It seems like the <> part is lost something.

I found in source file control_flow.md Line 99, this location has something:

Remember that the `else` part is optional. When included, 
it is always executed once after the `for` loop is over unless a <<the_break_statement,break>> statement is encountered.

So the problem seems like Markdown doesn't include this <the_break_statement,break> in HTML file.
Could you check this?

xrange not part of python 3

In control_flow.md xrange is mentioned. xrange is however not a part of python 3. xrange has become range, and range of python 2 is equivalent with list(range()) in python 3.

Mobi layout (Kindle)

Hi, in a Kindle paperwhite the layout appears with too many tabs, sometimes the text starts at the next line, attached screenshot:

screen shot 2016-08-31 at 4 42 33 pm

Note: this is the .mobi file downloaded at the website: http://python.swaroopch.com

What tools are there to convert? Calibre can?

PDF file formatting

Hello. I am now reading your book as my second book for Python. The book is instructive! I am trying to copy the code from the book's PDF and have problems with formatting when I paste the code into VS Code. Copying the code from your website works correctly. Attach the file from VS Code:
function_keyword.zip

Thanks.

"fab html" gives single HTML page not styled

Hi,

Someone compiled translated version of "A byte of Python" and put it online: http://zhgdg.gitcafe.com/static/doc/byte_of_python.html

There are two issues (same in origin version from this repo):

  1. It is one page only; not suitable for at least some learners. You know GNU documentation always choice between "entirely on one web page" and "with one web page per node".
  2. The HTML is not styled, except the code snippet. Can you include a default style sheet? For example, the one used in pandoc demo: http://johnmacfarlane.net/pandoc/demo/pandoc.css

Format code using black ?

I though this change should be discussed a bit.

I propose to format the python code using black, in order to have consistent code across the book.
Consistency is also important in coding, so I though it should be applied in a learning book.

Link Syntax Error

In oop.md Line 49:

(We will learn <<init,more about instantiation>> in the next section)

It seems like it should be a link, but the syntax it is using is not a Markdown style.
Please have a check and fix it.

Org version

I enjoyed reading this book. I read the Revision History and would like to suggest Org Mode as the next version. It supports exporting to AsciiDoc, LaTeX (PDF), HTML, etc. It renders well on GitHub. It also is an interactive format if people want, and supports (optionally) export to Jupyter (as requested by #104, #107, and presumably others).

This book is 10 years old - I suggest Org will still be around in 10 years, but many other formats may not exist in another 10 years.

Extention towards juypter books

I love the book and the website (I learned python with it). But I wonder if it would be possible to move the content towards a jupyter book such that the compute instructions become executable on something like binder without any needed installs.

Mention String interpolation?

The format method was introduced in the Basic chapter.

Since Python now has String interpolation, maybe it would be an idea to mention that also here?

PDF Document Properties "Commenting: Not Allowed"

pdf-commentingnotallowed
Right Click on the PDF Document, choose Document Properties, click Security Tab.

"Commenting: Not Allowed"

i was hoping to add comments and bookmarks and hilighting to parts of the document.

Newest (2014-12-02) or older versions of the PDF have the same issue. Have not figured out how to generate my own yet.

Tab completion

It took me a long time before I read somewhere that in at least IPython/Jupyter Notebooks (including those on https://wakari.io), IDLE and Spyder tab completion can be used. Meaning that if you start a statement and then press the tab-key a list pops up from which you can choose a completion of your statement. Coming from Microsoft Visual Studio and RStudio where the lists pop up automatically, I didn't expect something like that. I just thought that Python environments didn't work that well, and Notebooks the least of all, because typing a dot doesn't result in a list.

Tab completion is very helpful for beginners (and experts alike I suppose) so I think it would help if this would be clearly mentioned in the book.

Maybe an inaccurate description in Inheritance section

Hi swaroopch,

I am reading your awesome byte-of-python, but find the following words in Inheritance from Object Oriented Programming may not be accurate:

To use inheritance, we specify the base class names in a tuple following the class name in the class definition. Next, we observe that the init method of the base class is explicitly called using the self variable so that we can initialize the base class part of the object. This is very important to remember - Python does not automatically call the constructor of the base class, you have to explicitly call it yourself.

I think "Python does not automatically call the constructor of the base class, you have to explicitly call it yourself." will mislead people. The root cause of this example is the __init__ method in derived class overrides the __init__ method in base class. Actually, Python does automatically call the constructor of the base class as long as the derived class doesn't override this method. E.g.:

class Base:	
	def __init__(self):
		print("Base __init__ is called!")

class Derived(Base):
	pass

Derived()

The output of above code is like this:
Base __init__ is called!

So if the derived class's method overrides base class's method, the base class's method won't be called, no matter it is __init__ or not:

class Base:	
	def Haha(self):
		print("Base Haha is called!")
		
class Derived(Base):
	def Haha(self):
		print("Derived Haha is called!")

Derived().Haha()

The result is:
Derived Haha is called!

Best Regards
Nan Xiao

Notebook based versions of this course

Thanks for this wonderful bytes.

Feature Request

Can we create a Jupyter notebook or google colab notebook .
This will help to run the snippet within the page and the learner may not need to navigate/copy away to another editor/IDE.

'+Terminal+' with wrong symbol '+'?

In Installation,

To verify, open the terminal by opening the +Terminal+ application or by pressing [Alt + F2] and entering +gnome-terminal+.

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.