len
:::python
len('abc') # -> 3
len([1, 5, 2, 3]) # -> 4
def validate_attr(instance, attr, valid, errors=None, positive=True): | |
'''Returns a list of errors (strings) for mom objects attribute | |
validation. | |
Parameters: | |
instance: instance or list of instances to validate. | |
attr: attribute name or list of attributes names as strings. | |
valid: valid value or list of valid values (invalid values if | |
positive=False). | |
errors: an optional list to aggregate the errors into. |
import java.util.Map; | |
import processing.video.Movie; | |
String MOVIE_FILE = "videofile"; | |
String OUTPUT_DIR = "pos/"; | |
int SEEK_INTERVAL = 4; | |
String OBJ_NAME = "object_name"; | |
DisposeHandler dh; |
$(document).ready(function() { | |
$("#submit_button").on("click", function() { | |
window.history.replaceState({}, 'foo page', '/foo'); | |
}); | |
}); |
import Tkinter as tk | |
import serial | |
ANGLE_MIN = 0 | |
ANGLE_MAX = 180 | |
SERVO_MIN = 1 | |
SERVO_MAX = 4 | |
# Assign Arduino's serial port address | |
# Windows example |
''' | |
This program controls the state of the waterpump and | |
LED's of the nuclear power station. | |
If the pump stops working a countdown of 10 seconds starts | |
ticking and then does 2 things: | |
1) turning on red lights instead of blue lights in the | |
reactor's core. | |
2) cutting the power: writing outpin HIGH (on the arduino | |
of the power system this will set the power out. |
import java.util.List; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
class Exercise { | |
public List<String> ex; | |
public Exercise(String[] input) { | |
ex = new ArrayList<String>(Arrays.asList(input)); |