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.
-
Create a HTML page which uses JavaScript (jQuery is fine) to print the numbers from 1 to 100 as elements in an unordered list.
-
Using CSS, make every other item in the list (eg. all even numbers) have a different background color.
-
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".
- You will need a
for
loop - The
nth-child
CSS selector is very helpful here.
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)