Welcome to Code Sharer, a code gallery for creating, saving and sharing all kinds of code snippets.

Snips Tagged "python 3" 4 results found

Draw a Circle using Turtle in Python 3 Python 173
Author: Ryan Bradley-Evans (Admin) Posted On: Friday, August 3, 2018 at 6:06 AM

This is a short script shows you how to draw a circle using the Turtle package in Python 3.

I have done a staged circle so you can gain some appreciation as to how the turtle.circle() function works.

The colours are defined using HTML colour codes.





Drawing lines using Turtle in Python 3 Python 108
Author: Ryan Bradley-Evans (Admin) Posted On: Saturday, August 4, 2018 at 5:07 AM

This is a short script shows you how to draw straight lines using the Turtle package in Python 3.

Each line is a different colour for clarity

The colours are defined using HTML colour codes.






Control a relay on the Raspberry Pi using Python Python 128
Author: Ryan Bradley-Evans (Admin) Posted On: Sunday, August 5, 2018 at 1:17 PM

This code is written in python 3. It is intended to be part of a larger program to control lights on a timer using a relay attached to GPIO pin 18 on the raspberry pi.





THIS IS A WORK IN PROGRESS

A simple rounding function for Python 3 Python 123
Author: Ryan Bradley-Evans (Admin) Posted On: Thursday, September 6, 2018 at 11:44 AM

There are no library dependencies for this to work.


The syntax can easily be changed to work with Python 2.


To use, include the code after your imports section of your program then type round(x) where you want a number to be rounded. replace x with the float you want to be properly rounded.