- Selectors
- Transitions
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
var target, guess_input, guess_input_text; | |
var finished = false; | |
var guesses = 0; | |
function guessing_game() { | |
var random_number = Math.random() * 100; | |
var random_number_integer = Math.floor(random_number); | |
target = random_number_integer + 1; | |
while (!finished) { | |
guess_input_text = prompt("Guess what number I'm thinking of? "); |
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
// I was thinking about making this a nice HTML page... another day perhaps | |
Working with Strings: | |
[textNormalizer.js] https://gist.github.com/misterhtmlcss/b6f1ef8a76308c975c2faac4951acdd5 | |
[Shouter.js] https://gist.github.com/misterhtmlcss/6bb9b08d140b57b0dddf472eb26c4443 | |
[wisePerson.js] https://gist.github.com/misterhtmlcss/20126d550d9019652639b38ae8079e0b | |
Working with Numbers: |
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
""" | |
# Part 2 | |
Write your own function that illustrates a feature that you learned in this unit. The function must take at least one argument. The function should be your own creation, not copied from any other source. Do not copy a function from your textbook or the Internet. | |
Include all of the following in your Learning Journal: | |
✓ The code for the function that you invented. | |
✓ The inputs and outputs to three calls of your invented function. | |
✓ A description of what feature(s) your function illustrates. |
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
# x = -10 | |
# x = 0 | |
# x = 2 | |
if x != 0: | |
print("This number ", x, " is not 0.") | |
else: | |
print(x, " is 0") | |
# I think the not operator is interesting. |
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
# ************************** | |
# CS1101 - Discussion Unit 5 | |
# ************************** | |
# ************************** | |
# Instructions | |
# 1. Check whether its argument has any lowercase letters | |
# 2. Describe what it actually does when called with a string argument and if it does not correctly check for lowercase letters. | |
# 4. Give an example argument that produces incorrect results. (SEE BOTTOM for 3 calls to all functions!) | |
# 5. Describe why the result is incorrect. (SEE inline comments) |
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
# Describe how catching exceptions can help with file errors. Write three Python examples that actually generate file errors on your computer and catch the errors with try: except: blocks. Include the code and output for each example in your post. | |
# There are two ways to catch an error; handle it gracefully, which is done in the last except statement, but in the first one with ZeroDivisionError we apply the initial part of second implementation that is more dynamic and some would say 'useful' to the user and development team. When an exception is specifically targeted this allows for a software developer to more easily develop an 'antidote' to the issue. In this case division by 0. Possibly this could lead to a solution that upon exception returns 0. | |
# Describe how catching exceptions can help with file errors. | |
# Catching errors can mean two things; the graceful handling of your program failing. Rather than a crash! Can anyway anyway 2k bug? This means your code is more durable to errors. | |
def test_excepti |
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
// Lets highjack the links and make them all open in new tabs! | |
// Let's identify the problems! | |
// 1. We need to get ALL the links right? | |
const links = document.querySelectorAll('a'); | |
// 2. TEST to see if the capture worked AND What did we get? | |
console.log(links[0]) | |
// 3. Ok, this looks interesting. What datatype do we have? |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<!-- | |
The following 2 meta tags *must* come first in the <head> | |
to consistently ensure proper document rendering. | |
Any other head element should come *after* these tags. | |
--> | |
<meta charset="UTF-8"> |
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
""" | |
# Part 1 | |
The volume of a sphere is 4/3πr3, where π has the value of "pi" given in Section 2.1 of your textbook. Write a function called print_volume (r) that takes an argument for the radius of the sphere, and prints the volume of the sphere. | |
✓ Call your print_volume function three times with different values for radius. | |
✓ Include all of the following in your Learning Journal: | |
- The code for your print_volume function. | |
- The inputs and outputs to three calls of your print_volume. |
OlderNewer