Skip to content

Python-3

practice-python-3-with-the-fibonacci-sequence

Learn Python with a simple "do it yourself" challenges. I went to bed thinking "how could I do the Fibonacci sequence without looking on the internet. Next day, getting python skills into practice, I came up with the below basic python code:

In mathematics, the Fibonacci numbers form a sequence called the Fibonacci sequence. Each number is the sum of the two preceding ones, starting from 0 and 1.

Thought I would share this challenge in case there is someone out there looking to practice Python 3 as weel. This is a simple and fun challenge. Try not to copy this code, create your own version, start simple, maybe just add numbers, then add the conditions while loop.

python fibonacci sequence

No matter how we present these numbers, it always seems to be impressive. Maybe that is why they are also known as the "gold ratio".

Learn more about the Fibonacci numbers and sequence in this wikipedia page.

Let me know if this was useful.


Happy learning

Antonio Feijao UK

python3-merry-christmas

Python 3 prints Merry Christmas Everyone!

Merry Christmas with Python3 script

var="Merry Christmas Everyone!"

print (var)

pip3-list-installed-upgrade-all

So, I want to list the packages installed with pip3 and now that I can see them, I want to update them all.

List pip3 installed packages

pip3 list

Update all my pip3 packages

with a for loop you can loop through all your packages, exclude what is not a package and run the command pip3 {package} --upgrade on the installed packages.

for n in $(pip3 list | awk '{print $1}' | egrep -v 'Package|^-'); do
    pip3 install --upgrade ${n} ;
done

pip update outdates packages

Just another way of doing it.

for package in $(pip list -o | cut -f 1 -d ' ' | tail -n +3); do pip install --upgrade ${package}; done

If you know a better way, do let me know! :)

Beware of dependencies packages or minimum and max versions.

Use at your own responsibility.

Happy learning,

Antonio Feijao

python-3-http-server

A quick and simple way to start a webserver on the current directory with Python 3 using module http.server


{% highlight bash linenos %}

python3 -m http.server 8000 --directory .`

{% endhighlight %}


Happy learning and keep practicing!

Antonio.Cloud

python3-learning

Python 3 learning for the first time

I have a background in shell scripting, so when I had to automate something, bash scripting would do the job just fine!

I also want to learn Python because is widely use nowadays and easy to integrate in most AWS Services, specifically useful for events with Lambda in AWS within serverless architectures.

Took me a while to do something useful with Python 3. At first, seemed an easy language to learn, and I still think it is!

If you already started first steeps, you know you can easily do print a print ("Hello World"), and you probably learnt a difference on the print command. From Python 2 to Python 3, you now have to use the parentheses ( ... )...

Just the command print is not enough to make something useful.

I thought that there might be someone else out there struggling to get started in Python 3, so I decided to share my experience on "How I start learning Python 3 and doing something useful".

You can execute command directly from running the command python3

CommandLine $ > python3
Python 3.7.4 (default, Jul  9 2019, 18:13:23)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print ("Hello World for AntonioCloud.com")
Hello World for AntonioCloud.com
>>>
>>> exit()
CommandLine $ >
CommandLine $ >

Then, I installed ipython and practice from there, but I was still on the basics commands and wanted to learn more.


Learn Python 3 on-the-go offline and mobile phone

After trying the basics, I set myself to practice on commute or free time.

Started by downloading the mobile app SoloLearn and started to practices while I was on commute. Some time later I completed the course, and Hey! Actually the final certificate feels like a good and well deserved rewards for completing the corse.

Here is mine [Antonio SoloLearn Python Certificate].


Learning by doing and practice often

So, after that, it really boosted my Python 3 skill when i started the fun project Stranger Things Alphabet Wall Lights.

With a fun challenge and with some physical visual result I felt is a lot more engaging.

commandI set fun challenge, something simple that only requires for loops, while loops and


Feedback

Feel free to leave a feedback and share your experience.

(...)

raspberry-pi-stranger-things-alphabet-wall-lights

Stranger Things Alphabet Wall Lights with Raspberry Pi Python 3 and Neopixels

It all started with the launch of Stranger Things Season 3.

We, Kat Decided to invite a couple of friend for the first episode of ST Session 3 and why not create some scary wall that spells out some words?!

Why not, right?

Proof of Concept

What I used:

  • 1x Raspberry PI 3b+ with power supply
  • 1x Pack of 50 addressable RGB LEDs from Amazon - (LINKS)[LINKS]
  • 1x Power supply 5V for the Raspberry PI
  • 1x Power supply 5v for the LEDs
  • 1x breadboard with a couple electric cables

(...)