In Python we can unpack a list or a dictionary as function arguments using *
and **
.
def print_numbers(x, y):
print x
print y
#include <iostream> | |
#include <utility> | |
std::pair<int, int> getFraction(int a[], int size) | |
{ | |
int n = 1; | |
int d = a[size-1]; | |
for(int i = size - 2; i >= 0; i--) | |
{ | |
int nextd = d*a[i] + n; |
#include <iostream> | |
#include <utility> | |
std::pair<int, int> getFraction(int a[], int size) | |
{ | |
int n = 1; | |
int d = a[size-1]; | |
for(int i = size - 2; i >= 0; i--) | |
{ | |
int nextd = d*a[i] + n; |
from __future__ import print_function, division | |
import sys | |
def contfrac_to_frac(seq): | |
''' Convert the simple continued fraction in `seq` | |
into a fraction, num / den | |
''' | |
num, den = 1, 0 | |
for u in reversed(seq): | |
num, den = den + num*u, num |
from datetime import date | |
year = int(input("Anio de nacimiento: ")) | |
month = int(input("Mes de nacimiento: ")) | |
day = int(input("Dia de nacimiento: ")) | |
def born(year, month, day): | |
today = date.today() | |
return today.year - year - ((today.month, today.day) < (month, day)) |
server { | |
listen 80; | |
server_name subdomain1.domain.com; | |
location / { | |
proxy_pass http://localhost:{YOUR_PORT}; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection 'upgrade'; |
var menu = document.getElementsByClassName("your-elements"); | |
for(var i = 0; i < menu.length; i++){ | |
if(menu[i].getAttribute("href") == window.location.pathname){ | |
menu[i].id = "devf-selected-menu" | |
} | |
} |
public class Mamifero { | |
private int patas; | |
private String nombre; | |
public void imprimirPatas() { | |
System.out.println(nombre + ” tiene ” + patas + ” patas\n”); | |
} | |
public Mamifero(String nombre, int patas) { | |
this.nombre = nombre; |