Skip to content

Instantly share code, notes, and snippets.

View emerak's full-sized avatar
🏠
Working from home

Alejandra Cernas emerak

🏠
Working from home
View GitHub Profile
@emerak
emerak / gist:1850635
Created February 17, 2012 04:24
Gettting the hour of the system without DOS interruptions
mov AH,04H
int 1AH
mov bh,10h
mov al,dl
div bh
mov bl,al
add bl,30h
@emerak
emerak / Dictionaries.py
Last active December 12, 2015 02:08
Dictionaries - LearnPython.org My answer to the excercise
phonebook = {
"John" : 938477566,
"Jack" : 938377264,
"Jill" : 947662781
}
# write your code here
phonebook["Jake"] = 938273443
phonebook.pop("Jill")
@emerak
emerak / BasicOperators.py
Created February 6, 2013 00:53
Basic Operators - LearnPython.org
x = object()
y = object()
# change this code
x_list = [x] * 10
y_list = [y] * 10
big_list = x_list + y_list
print "x_list contains %d objects" % len(x_list)
print "y_list contains %d objects" % len(y_list)
@emerak
emerak / Exercice2.py
Created February 6, 2013 00:47
Variables and Types - LearnPython.org
# change this code
mystring = "hello"
myfloat = 10.0
myint = 20
# testing code
if mystring == "hello":
print "String: %s" % mystring
if isinstance(myfloat, float) and myfloat == 10.0:
print "Float: %d" % myfloat
@emerak
emerak / Lists.py
Created February 6, 2013 01:00
Lists - LearnPython.org
numbers = [1,2,3]
strings = ["hello","world"]
names = ["John", "Eric", "Jessica"]
# write your code here
second_name = names[1]
# this code should write out the filled arrays and the second name in the names list (Eric).
print(numbers)
@emerak
emerak / StrFormat.py
Created February 6, 2013 01:09
String Formatting - LearnPython.org
data = ("John", "Doe", 53.44)
format_string = "Hello %s %s. Your current balance is %.2f$."
print format_string % (data[0],data[1],data[2])
def rotate(arr,index)
rotated_array = []
arr.each_with_index do |a,i|
new_index = i + index
if new_index >= arr.length
while new_index >= arr.length do
new_index = new_index - arr.length
end
rotated_array.insert(new_index, a)
else