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
using UnityEngine; | |
using System.Collections; | |
public class NumberWizardRandom : MonoBehaviour { | |
// Use this for initialization | |
int max; | |
int min; | |
int guess; |
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 video = document.querySelector('video'), | |
image = document.querySelector('#selfie-image'), | |
// Get the exact size of the video element. | |
width = video.videoWidth, | |
height = video.videoHeight, | |
// Context object for working with the canvas. | |
context = hidden_canvas.getContext('2d'); |
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
// Get an image dataURL from the canvas. | |
var imageDataURL = hidden_canvas.toDataURL('image/png'); | |
// Set the dataURL as source of an image element, showing the captured photo. | |
image.setAttribute('src', imageDataURL); |
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
# this dictionary only has one entry | |
example_dictionary = {"key": "value"} | |
# this dictionary has multiple entries | |
another_dictionary = { | |
"first_key": "cool_value", | |
"second_key": "awesome_value", | |
"lots_of_keys": "cool_value" | |
} |
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
list1 = [1, 2, 3] | |
list2 = [2, 3, 4] # different | |
# luckily the keys are unique here | |
dictionary = { | |
# list1 = [1, 2, 3] | |
list1: "a_value", | |
# list 2 = [2, 3, 4] | |
list2: "another_value" | |
} |
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
list2.insert(0, 1) # inserting number 1 at index 0 | |
list2.pop() # removing the last value | |
list1 = [1, 2, 3] | |
list2 = [1, 2, 3] | |
# oh no! which value will we get? | |
dictionary = { | |
# list1 = [1, 2, 3] | |
list1: "a_value", | |
# list 2 = [1, 2, 3] |
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
list2.insert(0, 1) # inserting number 1 at index 0 | |
list2.pop() # removing the last value | |
list1 = [1, 2, 3] | |
list2 = [1, 2, 3] | |
# oh no! which value will we get? | |
dictionary = { | |
# list1 = [1, 2, 3] | |
list1: "a_value", | |
# list 2 = [1, 2, 3] |
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
all_students_stuff = { | |
"bob": ["backpack", "sneakers", "hat"], | |
"elena": ["gloves", "hair brush", "cleats"], | |
"piper": ["backpack", "sneakers", "hat"] | |
} |
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
all_students_stuff = { | |
"bob": { | |
"clothing": ["sneakers", "hat"], | |
"storage": ["backpack"], | |
"food": ["apple sauce", "sandwich"] | |
}, | |
"marie": { | |
"clothing": ["gloves", "cleats"], | |
"hair stuff": ["hair brush"] | |
}, |
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
for name in name_list: # we go over every name in the list | |
name = name.title() # we change every name | |
counter += 1 # each time, we add 1 more to the counter |
OlderNewer