Jump to content
YOUR-AD-HERE
HOSTING
TOOLS
992Proxy

Locked [Python] Funcion sRandom


Expermicid

Recommended Posts

Funcion generadora de variables.

 

[lenguaje=python]#!/usr/bin/env python

 

##################################

## ##

## Funcion sRandom ##

## By expermicid ##

## Fecha : 15/10/12 ##

## ##

##################################

 

# importamos la libreria 'random'

import random

 

# funcion que genera la variable

def Generar(longitud) :

variable = ""

for i in range(int(longitud)) :

variable = variable + random.choice('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')

return variable

 

# pedimos por consola la longitud

long = raw_input("Introduzca la longitud de la variable > ")

 

# imprimimos la variable generada

print ">>> " + Generar(long)

[/lenguaje]

 

This is the hidden content, please

 

Saludos

Edited by Expermicid
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.