Question: I'm working on a rails app (if that's relevant) and I'm needing to have users create a list of event at businesses all over the world and I'm wondering what the best way to structure it would be. I would like for the user to select a country, then a state inside of that, and then a city, and then a business where each selection scopes the options for the next. If a business doesn't exist in the database, I want to allow the user to type in their option and then that will be a possible selection for the next user who goes through this process. What's the best way to approach this? 

I'm assuming I need to model this as country has many states has many cities has many businesses.. please let me know if this is the correct structure for this.

Also, are there common databases of countries/states/cities that I should use? Are there services that I should use? Is there a benefit to one over the other, or is there a completely different, better approach? I know this is nothing new, but I'm not sure of the best way to approach this, so I'm looking for some direction.. 

Let me know what you all have learned from experience. 

Thanks!

Answer: 
Your friends code contains a few errors. I modified the code to look like the example below:

```
import turtle
k = 4
t = turtle.Turtle()
t.speed(200)
t.pensize(1)
t.pencolor("blue")
x = 3
while True:
    for i in range(1, x):
        t.forward(i)
        t.left(360/x)
    x = x + 1

```

Nevertheless, Lets take it step by step:

1. The first line, `import turtle`, imports all the code written in a python file called turtle, into the file your in now. The turtle **module** allows you to draw lines and shapes using a virtual pen to draw them.
2. The next line, sets the variable `k` equal to the number `4`.
3. The third line is a bit hard to understand for a beginner, but basically what your doing is making a **turtle object** by using a class that was written in the turtle python file called `turtle.Turtle`. You should note that I'll cal our turtle object `t` not `turtle` as the module name your importing is named turtle already.
4. After creating our turtle object using turtle, it now has all the attributes and methods of the `turtle.Turtle` class. One of the methods available is called `speed()`. This controls the speed of your turtle when drawing lines or shapes.
5. The fourth line should be pretty self explanatory. On our `turtle.Turtle` object called `t`, we have another method called pen-size used to set the size of the pen used for drawing.
6. The Fifth line just uses another method in the `turtle.Turtle` class to set the pen-color for drawing, blue.
7. the sixth line sets the variable `x` equal to the number `3`
8. The next lines create a while-loop that will run forever. In that while-loop we tell python to:
9. run a for-loop in the range 1 to 3 exclusive. In other word, run the for-loop 1 time.
10. On each iteration of the **for-loop**, move our turtle pen forward 1 pixel.
11. On each iteration of the **for-loop**, move our turtle pen left 180 degrees.
12. The last and final line, increments the `x` variable by `1` number on each iteration of the **while-loop**, not the **for-loop**.

When the program is run, it will look something like the photo posted in Lyang's answer.
There are some errors in the code, such that `k` is not used, `t` does not exist (`turtle = turtle.Turtle()` should be `t = turtle.Turtle()` instead). I am assuming that `n` should be `i` instead.

Turtle is a package from python, but it is not a required package so your code might not run on online interpreters. When it runs, it generates an image like this (in an animation):

[![enter image description here](https://i.stack.imgur.com/x2HwY.png)](https://i.stack.imgur.com/x2HwY.png)