Skip to content

Instantly share code, notes, and snippets.

@jumalhackbright
Last active August 29, 2015 14:16
Show Gist options
  • Save jumalhackbright/4471a2d97f29830eb8c7 to your computer and use it in GitHub Desktop.
Save jumalhackbright/4471a2d97f29830eb8c7 to your computer and use it in GitHub Desktop.

Full Stack Entrance Quiz

Audience: Students who haven't completed the Front End Web Development course but have equivalent experience and want to figure out if they are ready for the Full Stack course.

Tasks

  1. Create a HTML page which uses JavaScript (jQuery is fine) to print the numbers from 1 to 100 as elements in an unordered list.

  2. Using CSS, make every other item in the list (eg. all even numbers) have a different background color.

  3. Write a Python program which asks the user for their name and prints out their 'hacker' name. Their hacker name is a randomly capitalized, space-free version of their name, with letters replaced by numbers according to the following scheme:

     A -> 4
     E -> 3
     I -> 1
     O -> 0
     T -> 7
    

    e.g. "Acid Burn" becomes "4c1DBuRn".

Hints (ideally, not needed)

  1. You will need a for loop
  2. The nth-child CSS selector is very helpful here.

Solution

There are a couple of ways to do each of these but the general idea is:

<html>
  <head>
    <script src="jquery.min.js"></script>
    <style>
     li:nth-child(even) {
        background-color: green;
     }
    </style>
  </head>
  <body>

  <ul id="parent">

  </ul>

  <script>
    for (i=1; i<101; i++) {
      $('#parent').append('<li>' + i + '</li>');
    }
  </script>
  </body>
</html>
import random

letter_transforms = {
  "a": 4,
  "e": 3,
  "i": 1,
  "o": 0,
  "t": 7
}

user_name = raw_input("What is your name? ")

basic_name = user_name.replace(" ", "").lower()

hacker_name = ""

for letter in basic_name:
  if letter in letter_transforms:
    hacker_name += str(letter_transforms[letter])
  else:
    capitalize = random.choice([True, False])
    if capitalize:
      hacker_name += letter.upper()
    else:
      hacker_name += letter

print "Your hacker name is: {}".format(hacker_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment