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 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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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
Blog My Very First Ever Python Programme and on a Raspberry Pi
  • 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
GPIO Pinout
Raspberry Pi Wishlist
Comparison Chart
Quiz
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: dubbie
  • Date Created: 14 Mar 2020 1:08 PM Date Created
  • Views 3000 views
  • Likes 8 likes
  • Comments 18 comments
Related
Recommended
  • python;
  • rpi-bc

My Very First Ever Python Programme and on a Raspberry Pi

dubbie
dubbie
14 Mar 2020

I wished to join the Raspberry Pi day activity so I decided that I would combine this with writing my very first own Python programme as well. I recently did an online Python course which had some directed programmes in but I wanted to make up my own unassisted. As I am shortly going out for lunch this had to be very short so I decided on

 

print("Hello and Happy Pi Day")

 

Next I needed my Raspberry Pi which is still integrated into my HoloPiBot (HoloPiBot #10 : It Actually Works - It Really Does! ) so I just plugged in cables, keyboards, mouse and eventually power supply  (when I found it!) as I vaguely remembered how to do. Turned it on and amazingly it still all worked. I must have learned something after all. There is a bit of video of this, but the battery on my camera ran out - it doesn't seem to be charging so I might need a new camera - and this is all I captured.

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

Following this I needed to start Python. I had no idea whether my Pi had Python so I decided to Google it, using my Pi, of course. Seems that it does have Python so I just went to the command line, typed in Python, then the programme above and it worked! If I have time over this weekend I might now try flashing an LED on and off - no promises though.

 

The Power of computing.

 

image

 

Dubbie

  • Sign in to reply

Top Comments

  • airbornesurfer
    airbornesurfer over 5 years ago in reply to dubbie +4
    Sudo ("superuser do") is basically the shorthand for all elevated privileges in Linux. Or, as Randall Munroe so eloquently illustrated:
  • beacon_dave
    beacon_dave over 5 years ago in reply to dubbie +4
    You may find this MagPi beginner's guide on the Python GPIO Zero library of interest: https://www.raspberrypi.org/magpi-issues/Essentials_GPIOZero_v1.pdf
  • shabaz
    shabaz over 5 years ago in reply to beacon_dave +4
    With newer versions of Python 3, there's another option too - really nice: import math print(f"Hello and Happy {math.pi} Day") The Jive syntax highlighting has not kept up though! : )
  • beacon_dave
    beacon_dave over 5 years ago in reply to shabaz

    The possibilities are endless...

     

    import math
    print("Hello and Happy {:.2f} Day".format(math.pi))

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • shabaz
    shabaz over 5 years ago in reply to beacon_dave

    With newer versions of Python 3, there's another option too - really nice:

     

    import math
    print(f"Hello and Happy {math.pi} Day")

     

    The Jive syntax highlighting has not kept up though! : )

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • colporteur
    colporteur over 5 years ago

    Are you able to share the name of the online resource you used to prepare and provide your opinion?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • clem57
    clem57 over 5 years ago in reply to dubbie

    Yes, privileged access.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • dubbie
    dubbie over 5 years ago in reply to beacon_dave

    Dave,

     

    Thanks for this. I have downloaded this eBook and will review it later. Will these commands also work with an ordinary Pi?

     

    Dubbie

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • 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