Select Page
Convert Number into Words

Convert Number into Words

This is the python3 program, I wrote to convert a number into words. If you enter 464, it will print Four Six Four. The Flowchart This is the Flow Chart that I used to visualize my ideas. The Code a=input(“Enter a random...

Python Text to Speech

We use python module gTTS to convert any text to speech. This module uses Google text to speech engine to convert text to an mp3 file. Then we play the saved mp3 using the omxplayer. Installing gTTS This step is required only once. Go to the linux terminal window and...

Lesson 11

Instant Challenges IC1. Get 2 integers and multiply Get two integers from user and print the product of the two numbers. Enter the first number: 3 Enter the second number 2: 5 Result: 15 IC2. Get 2 decimal values and multiply IC1 will fail, if you enter a decimal...

Raspberry Pi Python Challenges

Some of these challenges will only involve writing python program, while others require building circuits as well. Difficulty level: Easy. Write a program that gets a string as input and prints the length of the string. Refer to https://w3cloud.com/academy/lesson-2/...

Lesson 5

In the previous lesson, you leaned about building a LED circuit and controlling it from your python code. We even made the LED blink. Python Functions You can build your own functions and call it from multiple places. Breaking down into functions, improve the...

lesson 4

Connecting LED   Turn on a LED import RPi.GPIO as GPIO import time ledPin=40 GPIO.setmode(GPIO.BOARD) GPIO.setup(ledPin, GPIO.OUT) GPIO.output(ledPin, GPIO.HIGH) time.sleep(5) GPIO.output(ledPin, GPIO.LOW) GPIO.cleanup() Blink an LED 20 times import RPi.GPIO as...

Lesson 3

List As the name suggests, a list stores a collection of similar data types. List allow duplicate values. fruits = [‘orange’, ‘apple’, ‘pear’, ‘apple’, ‘banana’] #adds ‘kiwi’ to the end of the...

Raspberry Pi: Change host name

You can change your Raspberry Pi’s host name. Your host name is referenced in two raspbian configuration files. Open up the terminal window. After you make these changes, reboot your raspberry pi. The following file will the default host name pi. Change it to...

Sending email from Python

You can send email from Python, using the smtplib library. This library is a built-in library, so there are no additional steps to install. In this example, we are using the SMTP server information for gmail. You can use any SMTP server to send email. When you run...