Questions and Answers
Problems and Solutions
Quotes help make search much faster. Example: "Practice Makes Perfect"
Sunday, November 25, 2012
Codecademy: "Review: Built-In Functions"
#sample solution
def distance_from_zero(param):
if(isinstance(param,(int,float))):
return abs(param)
else:
return "This isn't an integer of a float!"
print distance_from_zero(-1)
print distance_from_zero(-2.13)
print distance_from_zero("A string.")
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
This is an example of
scrolling text
using Javascript.
Popular Posts
Codecademy Learn Phaser: Keyboard Events 10/12
//Sample Solution const gameState = {} function preload() { this.load.image('codey', 'https://s3.amazonaws.com/codecademy-...
LearnStreet Mastermind Game Sample Solution Method 3
function checkAnswerWrongPlace(ans, realanswer){ // This method compares two input strings representing a player's guess ("an...
LearnStreet Python Lesson 4 Exercise 5
#sample solution def colorful_conditions(): color = "blue" if color == "red": return "firs...
Codecademy: Codeyear Making copies
//sample solution //Here is the original card object var card1 = {"suit":"clubs", "rank": 8}; //Create a ...
Codecademy: Codeyear By reference, I think you've got it!
//sample solution //Here is the original card object var card1 = {"suit":"clubs", "rank": 8}; //Create a...
SQL: Table Transformation Lesson 5 Sample Solution
Instruction: Find the id of the flights whose distance is below average for their carrier. Sample Solution: SELECT id FROM flights AS f...
#Python #Codecademy File Input/Output Reading Between the Lines
# note: The instructions state to use "text.txt" but an error comes up stating that the file does not exist # as a work around, ...
FreeCodeCamp Sum All Numbers In Range Sample Solution
function sumAll(arr) { var sorted = arr.sort(function(a, b){return a-b}); var sum = 0; for(var i=sorted[0]; i<=sorted[1]; i++){ ...
Codecademy Learn Statistics With Python Histograms Exercise 6/9
# Sample Solution # Import packages import numpy as np import pandas as pd # Read in transactions data transactions = pd.read_csv(...
Codecademy Learn Statistics With Python Interquantile Range Exercise 2/4
# Sample Solution from song_data import songs import numpy as np q1 = np.quantile(songs, 0.25) #Create the variables q3 and interquarti...
No comments:
Post a Comment