Hi,
Me and my friend Ethan have created a python module containing some functions that simplify such things as getting a random item from a list or checking if a number is even. The module is called useful beginner functions or ubf for short.
Here are all the functions:
numberinput(str): shows a standard prompt which you can do with raw_input(), but returns the number you type.
file_read(filename): returns the contents of a file.
file_write(filename,str): writes a string to a file. filename is obviously the file to write to, for example file.txt or something like that and str is the string to write to it.
listtostring(list): takes a list and converts it into a string.
listcon(list1,list2): puts 2 lists together into one list.
password(pwd,str): displays a prompt over and over again until the player gets the password right. Password is the password that is right, and str is the string to display when the prompt pops up, for example: Enter the password.
openurl(url): Opens a website in your default browser.
circum(r): Gets the circumference of a circle.
file_delete_contents(filename): Deletes the contents of a file.
is_even(number): Returns 1 or 0 depending on if a number is even or not.
randlist(list): returns a random item in a list. For example if you had a list containing the items apple, orrange, and bananna, it could return any one of those 3.
Those are all the functions. The link is: https://dl.dropboxusercontent.com/u/24767067/ubf.py
Pages 1