This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QUESTION #6-- | |
Create a program that determines how many years you have left until retirement and the year you can retire. It should prompt for your current age and the age you want to retire and display the output as shown in the example that follows. | |
Example Output | |
What is your current age? 25 | |
At what age would you like to retire? 65 | |
You have 40 years left until you can retire. | |
It's 2015, so you can retire in 2055. | |
Constraints | |
• Again, be sure to convert the input to numerical data before doing any math. | |
• Don’t hard-code the current year into your program. Get it from the system time via your programming lan- guage. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#EXERCISE #1 | |
#diff21--Given an int n, return the absolute difference between n and 21, except return double the absolute difference if | |
#n is over 21. | |
#first solution try--only got 1 out of 12 correct | |
def diff21(n): | |
if n < 21: | |
return n *2 | |
else: | |
return n - 21 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JS Exercises sent by Anna(Thinkful) through email 7-13-17 | |
PRACTICE THE FOLLOWING: | |
FUNCTION EXERCISES | |
1) Take this array, carData and write a function | |
that returns the highest value of the property of year: | |
2) THEN write a function that returns all the models, | |
in Uppercase and sorts them. --alphabetically? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Session Questions | |
//discuss difference between function and event? I am thinking they can be used interchangeably | |
//event.current.target vs. this | |
//when the console is not printing anything, what is going on?? | |
// | |
1. cat carousel | |
function thumbnailClicks() { | |
$('.thumbnail').click(function(event){//selecting thumbnail from html,and making an event | |
var image=$(event.current.target).find('img').attr('src');//creating a variable that will make current target an event. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Display exercise project HTML | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>CSS Layout Exercises | display property</title> | |
<meta charset="utf-8" name="description" content="Layout exercise on `display` property for Thinkful's front end web development course"> | |
<!-- fonts --> | |
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.) Creating arrays | |
//function with 3 arguments, item1,item2,item3 | |
//return three items as an array | |
function makeList(item1,item2,item3) { | |
return [item1,item2,item3]; | |
} | |
2.) Adding array items | |
//function called addToList that accepts an array and an item as arguments, and returns the | |
//array with the item added to the end. Function will have side effect of changing original array. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Challenge Question Answer | |
function getTokens(rawString) { | |
// NB: `.filter(Boolean)` removes any falsy items from an array | |
return rawString.toLowerCase().split(/[ ,!.";:-]+/).filter(Boolean).sort(); | |
} | |
/returning a lowercase string which will be | |
/.split = split takes this expression and splits array based on character in | |
parenthesis | |
if character in parenthesis is not in original array, then array will return | |
original array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.) To complete the drill for element selectors below, you'll need to target section elements and h1 elements. Specifically: | |
Write one ruleset for sections that gives them a bottom margin of 90px | |
Write one ruleset for header elements that sets font-family to Helvetica. | |
HTML: | |
<main> | |
<section> | |
<header> | |
<h1>Really important section header</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.) Drill 1: Width, Height, Color, Border | |
In this drill, you’ll add classes to the two divs to create a blue box and a red box, as described in the code comments and paragraphs in the code pen. To complete this drill, you'll need to use the following CSS properties: | |
background-color | |
margin-bottom | |
border | |
SOLUTION: | |
html | |
<main> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.) Link Here, Link There | |
<main> | |
<h2>1. Open this Link THERE!</h2> | |
<p><a href = "#" target="https://www.stackoverflow.com">Stack Overflow </a></p> | |
--> Replace this text with a link that links to the Stack Overflow website and opens in a new tab. | |
<h2>2. Click a link to send email!</h2> | |
<p> <a href= "mailto:username@site.org?subject=link%20here%20link%20there%20linkhere,linkthere">Blank Email</a></p> | |
</main> | |
---> Replace the text in this paragraph that opens a blank email with the subject line, link here, link there |
NewerOlder