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

Snip Code Type — Python 10 results found

Magic 8 ball Python 258
Author: Ryan Bradley-Evans (Admin) Posted On: Wednesday, December 14, 2016 at 8:04 AM

Only 8 examples are programmed in to this code. However it is very simple to add more.

A very SUDO random number generator Python 201
Author: Ryan Bradley-Evans (Admin) Posted On: Wednesday, December 14, 2016 at 8:20 AM

A very SUDO random number generator

Variables And Names Python 224
Author: Ryan Bradley-Evans (Admin) Posted On: Saturday, January 14, 2017 at 7:56 AM

A sad little script to show the summation of variables and defining names.

Hangman Python 271
Author: Ryan Bradley-Evans (Admin) Posted On: Saturday, January 14, 2017 at 9:21 AM

This is a basic hangman game for python 2.7 there is one word, however, it would be simple to make a word bank to randomly choose words from.

Simple Spirograph Python 71
Author: Ryan Bradley-Evans (Admin) Posted On: Sunday, June 24, 2018 at 1:37 PM

Simple code to draw Spirographs by repeating circles.

Draw a Circle using Turtle in Python 3 Python 118
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 72
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 85
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

Fractal tree in Python 3 using Turtle Python 197
Author: Ryan Bradley-Evans (Admin) Posted On: Monday, August 6, 2018 at 5:48 AM

A simple rounding function for Python 3 Python 86
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.