Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions calculator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
function suma(a, b) {
return a + b;
}

function resta(a, b) {
return a - b;
}

function multiplicacion(a, b) {
return a * b;
}

function division(a, b) {
if (b !== 0) {
return a / b;
} else {
return "Error: División por cero";
}
}

function calculadora() {
const numero1 = parseFloat(prompt("Introduce el primer número: "));
const numero2 = parseFloat(prompt("Introduce el segundo número: "));

console.log(`La operación de suma para ${numero1} y ${numero2} es: ${suma(numero1, numero2)}`);
console.log(`La operación de resta para ${numero1} y ${numero2} es: ${resta(numero1, numero2)}`);
console.log(`La operación de multiplicación para ${numero1} y ${numero2} es: ${multiplicacion(numero1, numero2)}`);
console.log(`La operación de división para ${numero1} y ${numero2} es: ${division(numero1, numero2)}`);
}

calculadora();
26 changes: 26 additions & 0 deletions calculator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
def suma(a, b):
return a + b

def resta(a, b):
return a - b

def multiplicacion(a, b):
return a * b

def division(a, b):
if b != 0:
return a / b
else:
return "Error: División por cero"

def calculadora():
numero1 = float(input("Introduce el primer número: "))
numero2 = float(input("Introduce el segundo número: "))

print(f"La operación de suma para {numero1} y {numero2} es: {suma(numero1, numero2)}")
print(f"La operación de resta para {numero1} y {numero2} es: {resta(numero1, numero2)}")
print(f"La operación de multiplicación para {numero1} y {numero2} es: {multiplicacion(numero1, numero2)}")
print(f"La operación de división para {numero1} y {numero2} es: {division(numero1, numero2)}")

if __name__ == "__main__":
calculadora()
6 changes: 3 additions & 3 deletions card_draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import itertools, random

# make a deck of cards
deck = list(itertools.product(range(1,14),['Spade','Heart','Diamond','Club'])
deck = list(itertools.product(range(1,14),['Spade','Heart','Diamond','Club']))

# shuffle the cards
random.shuffle(deck)

# draw five cards
print("You got:")
for i in range(5)
print(deck[i][0], "of", deck[i][1]
for i in range(5):
print(deck[i][0], "of", deck[i][1])
97 changes: 97 additions & 0 deletions node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

88 changes: 88 additions & 0 deletions node_modules/data-uri-to-buffer/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions node_modules/data-uri-to-buffer/dist/index.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions node_modules/data-uri-to-buffer/dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/data-uri-to-buffer/dist/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading