Two must-know Python libraries


When working with dictionaries you probably encountered 2 problems:

1. No strict order.
2. A keyError is the key doesn’t exist.

These 2 problems can easily be solved without much hassle with 2 nice objects from the collections module in the Python standard library.
The first is the OrderedDict.
This object remembers the order in which it is made, so you will get the same order of objects when you loop through it, as when you first put the elements in. It works the same as a normal dictionairy in all ways

from collections import OrderedDict my_dict = OrderedDict() my_dict['first']="Gold" my_dict['second'] = "Silver" for medal in my_dict.values(): print(medal)

This will give:

The second object is the defaultdict.
This object lets you define what the default value is of a key so if you have not defined it yet, it will just get that value. The way this is assigned is by giving the function of its type like “list”,”dict”,”int”,”float” or by a function (or lambda) that returns the standard value
So a great use for this is when counting words in a text.
The variable “words_list” is a list with all the words from a text document in this example:

from collections import defaultdict counter = defaultdict(int) for word in words_list: counter[word] += 1

Now I can check for every word the count. If the word is not in the text, I do not get a KeyError, but the value 0.

Read this wizdom and more like it here

Javascript share buttons for your website


There are just a few steps that need to be followed in order to ensure that the share buttons work.
1. Ensure that jQuery is embedded in the head of the code.
2. Add the JavaScript link of the file which has the share buttons.

<script src=""></script>;  
<script src="">; 
<link type="text/css" rel="stylesheet" href="style.css">  
<script src="script.js"></script>  
<link href='|Audiowide';
rel='stylesheet' type='text/css'>  
<script type="text/javascript" src="/share.min.js"></script  

3. Trigger the javascript in


4. Add text and links to the share properties in HTML.

<h1 id="color">Colourity</h1> 
<div id="instructions">Press the space bar to get started, then click to 
<div class="targetDiv"></div>  

<script type="text/javascript"> 
$('.targetDiv').share({ facebook: { 
name: 'title' 
link: 'url' 
image: 'share image' 
caption: 'picture caption' 
text: 'short description' 

twitter: { 
text: 'tweet text' 
link: 'url' 
gplus: { 
link: 'url' 

The Network Tab

Important tip from Mat, a Javascript wizpert:

If you’re doing any sort of work on the web it will do you well to get familiar with the Networking tab of your browser. Most browsers have one and it makes troubleshooting a surgical process rather than just shooting in the dark. has all the details for chrome.

This tab will show you what’s happening with your page. Any red? You’ve got errors to deal with.

You’ll see quickly which URL is causing trouble and why making issues like “CSS not loading” easy to fix.

The developer tools also have a whole boat load of features. Learn them well and take the guess work out of web development.

Read this wizdom and more like it here

Announcing our partnership with Crossrider

We’re excited to announce our new partnership with Crossrider!

Crossrider is one of the world’s leading platforms for extension development, with over 1 Billion installations. It allows developers to quickly build awesome extensions that support all major browsers, using Javascript.

We are delighted that Crossrider chose Wizpert to provide instant programming help to their community of developers with extensions and related programming questions.

This partnership further validates Wizpert’s reputation as the world’s most helpful community for programmers.

Our experts (wizperts) have helped users with well over 50,000 questions, and we are proud to have been selected for mentoring by students from all the leading online and brick-and-mortar code learning schools and programs.





SQL – do you know the basics?

If you can answer these basic questions posed by Simeonc, one of our SQL wizperts, than you are beginning to master SQL.

Answers are provided for your convenience, but no cheating :)

Q.How to retrieve specific columns from a table?
A: The first thing is to know how they are placed into the table.

Q.What is an auto increment?
A: An auto increment is a feature in databases which allows each record to be unique to that table for identification.

Q.What is rownum?
A: A rownum is a special virtual column you get on subqueries in ORACLE.

Q.What is a Sub Query?
A.It’s called a ‘table expression’ and it’s essentially anything that returns a record set, such as views and stored procedures, functions, subqueries.

Q.Can a Sub Query be aliased and considered as a table?
A: Yes it can, only when it is in the FROM statement.

Read this wizdom and more like it here

Testimonial from a serial code learner

This guest post was written by Ron, one of our long time users. [Warning: not for the faint of heart]:

I’ve been working on teaching myself HTML/CSS and JavaScript for the past seven months and have found that virtually all, or at least most of the online tutorials are lacking in several areas.

The main issues are that they do not have the students work through projects, and they do not supply sufficient mentorship to help students in understanding the material and problems put before them.

I have learned the hard way that both of these are essential in learning how to code. You need to have a goal to continuously work towards, a site to build or build upon, and you need to have someone answer your questions and correct you where you went wrong.

This is where Wizpert came in and helped me.

I have worked with Code Academy, Code School, Thinkful, Udemy, Udacity, Lynda, Treehouse, PluralSight, Aquent, Gymnasium and a few others. Some are better than others in teaching the core essentials and all have many good points in the sense that they genuinely appear to want to help people learn to code.

However, in the end, they all (yes all) fall short in teaching budding beginners to fully grasp HTML/ CSS and JavaScript. I have also found the teach-yourself books to be of even less help, even when they are touted by experienced web developers as being of value to beginners. They are more useful as reference material than anything else.

Though several sites actually do provide a “mentor,” with whom you meet once a week…this simply. Does. Not. Work. At this day and age, that’s literally no better than me using the US Postal Service to mail someone my code problem and having them mail their answer back to me. I doubt I am alone when I say that when I need help figuring out why my stupid floating divs aren’t floating the way they’re supposed to, I want an answer right g#@damn now. Which is, again, where Wizpert has come in.

They provided me with the essential help at the drop of a hat, 24/7. I cannot be a loud enough cheerleader for them. When Stack Overflow fails to answer one of my questions, Wizpert comes through, every single time.

Go create an account with Stack Overflow and try, just try to ask them a couple of questions. You’ll soon see why they fail in helping the beginner. They’ll send you home crying because you’re asking (god forbid) for someone’s “opinion” on how you should use that new HTML5 semantic [article] and [section] tags that has everyone confused. If there were no opinions in coding then there would be no need for online tutorials or places like Stack Overflow and every program could be nice and neatly packed into one pretty little book. …don’t even get me started. Stack Overflow is definitely NOT for beginners.

And when Google has failed in dredging up an answer to your padding/margin question, Wizpert is there for you at 11:30 at night to also help you center that pesky div or fix the navigation, padding, margin, linking and hover issues of your unorganized list!!

Did Stack Overflow or Google ever help you figure out how to indent that third checkbox, just a few pixels more to the right?? I didn’t think so. It didn’t help me either. Which, again, is where Wizpert comes in. If you need help in understanding why your If/Else isn’t working or why your loop is infinite, crashing your system. Bam! There’s a wizpert right friggin’ there to help right friggin’ now.

The peace of mind of being able to get help right when I need it, any time of the day, has kept me rolling in my learning where I am now no longer getting hung up for hours and hours on one stupid little issue that turned out to be nothing more than an improper relative URL.

Thanks guys. Thanks for being there, saving me an infinite amount of hours. You’ve helped me from giving up.

Entering the field of programming

If you are a new programmer looking to broaden your horizon and seeking how to get hands on practice with programming then keep reading on.

With the competitive market and flood of web application developers all over the globe. There has risen new markets for various applications, every industry values a programmer with certain programming background based on the core structure of their application.

As a new programmer it is always advisable to start with C programming, no matter how simple the others may seem and how much they attract the crowd. With that in mind, it is also important to notice the market trend in order to jump into the other languages once “C programming” is mastered. Even though it may seem challenging, it is by far the best starting point because it teaches the core of all programming language.

Php, python, ruby and similar web frameworks can be easily mastered once C programming has taken root and strong programming applications in C have been mastered. This not only gives birth to a genuine programmer but also one who has the ability to go back and forth between various different programming languages.

Read this wizdom and more like it here

Working with Nested Divs in CSS

When web programmers work with nested divs, they have to take care of a few things in order to ensure that the nesting works.
Our wizpert Wilson provided these small tips, which will save you a lot of time and frustration in developing websites:

  1. Ensure that the inner divs have margins, in order to differentiate.
  2. Keep the border color different from the that of the div.
  3. Set a margin for the outermost div and give it a height and width.

Read this wizdom and more like it here

Coding a 9 by 9 Sudoku puzzle in Python

Our wizpert Samiksha created this cool Sudoku puzzle solver in Python.

Coding in python means that it is going to a web application, it involves inputs from a file and outputs to web. Creation of Sudoku puzzle involves a lot of math calculation involved in the laying out of grid properties. Further it also allows beginners to get a flow of how things are done in Python.

The following sample code can be used as a reference point for creation of Sudoku puzzles.

    import os

    cwd = os.getcwd()
    filename = cwd + "/sudoku1.txt"

    grid = []
    l = grid
    with open(filename) as f:
        for line in f:
            grid.append([int(i) for i in line.split()])

    def printGrid(result):  # prints grid with result
        for i in grid:

    def allDifferent1D(l):
        for e in l:
            if e != 0:       # ignores that there are many zeros
                if l.count(e) > 1:    #make sure only has 1 instance of a number
                    return False
        return True

    def allDifferent2D(l):
        for row in l:
            if not allDifferent1D(row):
                return False
        for c in range(len(l)):
            col = []
            for r in range(len(l)):
            if not allDifferent1D(col):
                return False
        return True

    def checkAll3By3s(grid):      #function goes through and assigns numbers in arrays and checks the grid
        for i in [0,3,6]:
            for j in [0,3,6]:
                column = []
                w =[]
                for k in column:
                    for p in k:

                if allDifferent1D(l) == False:
                    return False
                    return True 

    def isValidSudoku(grid):  # Check all rows and columns

        if (not allDifferent2D(grid)):
            return False
        if (not checkAll3By3s(grid)):
            return False
        return True

    def complete(grid):   #function that weather parameter is correct solution
        for i in grid:
            for b in i:
                if b == 0:
                    return False    #if it has zeros, then not complete
            return True    # returns true if there are no zeros

    def checker():       #function to call checkAll3by3
        if checkAll3By3s(grid) == true:
            return grid
            return False    

    def solveSudoku(grid):     #main function to solve

        if complete(grid) == True:    #
            return grid
        elif isValidSudoku(grid) == False:  #
            return None

        for i in grid:
            for b in range(0,9):   #  goes the indincies
                if i[b] == 0:
                    for w in range(1,10):    # sets w to be a number, 1,2,3,4,5,6,7,8 or 10
                        i[b] = w             # sets the spot in i[b] to the number 
                        c = solveSudoku(grid)   
                        if c != None:        
                            return c   # recursion
                    i[b] = 0      #  sets b back to 0
                    return None   #return none, only happen once we have done everythign

    result = solveSudoku(grid)
    if result != None:
        print("The solution is:")
        print("There is no solution.")

Read this wizdom and more like it here