element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum What is the best way to learn Python?
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Suggested Answer
  • Replies 38 replies
  • Answers 2 answers
  • Subscribers 680 subscribers
  • Views 4439 views
  • Users 0 members are here
  • learn
  • python
Related

What is the best way to learn Python?

peterjcs23
peterjcs23 over 10 years ago

I have written software in C for embedded processors. Raspberry Pi uses Python, so what is the best way to learn it? What is the best book? What about a web based tutorial?

 

C has a standard core and suppliers of compilers add functions. Is Python similar, do I need to learn the Raspberry Pi version?

 

Thanks, Peter

  • Sign in to reply
  • Cancel
  • michaelkellett
    0 michaelkellett over 10 years ago

    The Pi is Linux machine so you could use C if you wanted.

     

    You should only need to use Python if you want to use hardware with no C support.

     

    On the other hand Python is quite popular so you might want to learn it anyway.

     

    There is a lot of stuff on the web  - trawl about until you find something you like.

     

    Bookwise, I started with Beginning Python, Magnus Lie Hetland - published in 2005 - I don't much recommend it (not because there is anything wrong with it but because it's 10 years old now.)

     

    MK

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Problemchild
    0 Problemchild over 10 years ago

    Has Mike says you can use "C" on the RPI just fine the Compiler is supplied on the latest  Rasbian images with out needing to install it so you an just continue with this.

     

    Yes most released software on the RPI is in Python generally because it's simpler than C if you still want to learn it I would suggest starting a project that requires it and this should push you to learn.

     

    Alternatively how about taking a computing module on EdX that does Python like the MIT one... It's free even!

    (or 50$ for an exam  if you want a certificate)

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • royleith
    0 royleith over 10 years ago

    I suggest 'Learning Python' by Mark Lutz and David Ascher and published by O'Reilly as it often explains the Python way of dealing with c programming tasks. There are lots of examples and exercises (with solutions). Once you get to grips with the Python objects, the very best resource is the wonderful,

     

    https://www.python.org/

     

    In fact, browse the site, first, and see if the downloads and on-line references, tutorials and other documentation are enough to get you going. Once you get functions, strings,  tuples, lists, classes, dictionaries and the like, the documentation should make lots of sense.

     

    Imports are to Python as includes are to c. Python imports are modules which add functionality, but most of the ones you want are included by default when Python is installed (by default in the Pi). The Pi also has the IDLE IDE installed for both the current Python 2.7 (widely used across many platforms) and Python 3 (the future). I have written Python programs on the Pi which access the command line, use COM ports and the Tkinter GUI module and they run with minor changes on Microsoft Windows by installing the same modules.

     

    As Michael says, you can program in most languages using the Pi. However, Python on the Raspberry Pi comes as standard with a module to access the GPIO features (although the more complex issues such as I2C, serial and PWM have yet to be added). The Broadcom chip is complex and many of its features are entwined with the Linux operating system. It may not be that straight forward to use every GPIO feature. Also, the Pi2 puts its control and read registers at different addresses. The joy of using the Python modules is that the ins and outs of Linux and Broadcom are already sorted. There are plenty of examples of PWM and I2C programs written in Python just using the simple I/O pins rather than the dedicated Broadcom pins. However, C would be the way to go if you want precise time dependant programming as Python is interpreted and has the occasional mid-program tidy-up. Even pre-compiled Python may be a problem.

     

    I just checked with the Synaptic Package Manager and GCC is already installed in the Pi. Java is in the repository as is Fortran, Ada, Objective C, C++, Cobol... you get the idea! There are lots of others such as Ruby and Forth. However, if you want to use c or c++ you will have to do a fair amount of research to drive the GPIO hardware to the full without killing the operating system. All the usual OS stuff is available to C and C++.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • Capper
    0 Capper over 10 years ago

    Introduction to Computer Science and Programming Using Python

    edX - 6.00.1x is an introduction to computer science as a tool to solve real-world analytical problems

    https://www.edx.org/course/introduction-computer-science-mitx-6-00-1x-0#.VPSLYI6VkUM

    Scott

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • LenReinhart
    0 LenReinhart over 10 years ago

    If you haven't found it yet, http://www.themagpi.com/ is a free magazine about all things RPi. There are many projects in python as well as other languages. All the issues are available for download. There are 30 issues now plus some specials.

     

    Python is a high level language and it allows fast problem solving. If it turns out that the problem needs more speed, there are linkages to "C" so the low level stuff can go fast.

     

    I took a free course taught by the Google self driving car guy from https://www.coursera.org/   The course was great, but I don't think a complete python novice would appreciate it (unless fairly fluent in some other languages). There are other courses that are a bit more basic.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • Former Member
    0 Former Member over 10 years ago

    The edX course recommended by Scott is great.

     

    Also check out learnpythonthehardway.org

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 10 years ago in reply to Former Member

    Learn Python The Hard Way

     

    This will link you to the html online version. I have found this helpful myself. I have also been doing various book exercises as well to keep it changed up.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • peterjcs23
    0 peterjcs23 over 10 years ago in reply to michaelkellett

    Hi Michael, does the Raspberry Pi come with a C compiler, I thought Python was supplied? I see Python as a (personal) barrier to getting going with RsPi. so I'm going to set about learning it...Peter

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • michaelkellett
    0 michaelkellett over 10 years ago in reply to peterjcs23

    The RPI is (currently) a Linux thingy so GCC is available (see Roy's reply above)  so you can code in pretty much anything on it. I'm no RPi expert (I haven't ever used one and the only thing that would tempt me (a little) will be if Microsoft implement a decent go at Windows on it.)

     

    MK

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • peterjcs23
    0 peterjcs23 over 10 years ago in reply to michaelkellett

    It may not be Microsoft Word but this keeps popping up on twitter...

     

    http://www.element14.com/community/docs/DOC-74513/l/can-the-raspberry-pi-2-replace-your-desktop-computer?CMP=SOM-BLOG-LPOUNDER-TW

     

    biglesp

     

    ...says...


    LibreOffice is a free office suite that provides the same functionality as Microsoft Office. A standard install of LibreOffice provides you with applications such as

     

    • Writer - Word Processor
    • Calc - Spreadsheets
    • Base - Database
    • Impress - Presentation
    • Draw - Illustration
    • Math - Equations
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube