Entradas

Mostrando entradas de septiembre, 2019

Juego de Hector y Alexis

# -*- coding: utf-8 -*- import os, sys import random global cartas cartas=[2,3,4,5,6,7,8,9,10,'AS','J','Q','K'] suma1=0 suma2 = 0 global jugador1 jugador1 = [] global jugador2 jugador2 = [] print '\n ----Bienvenido a Black Jack----\n' op=0 while op!=6: op = input('Si desea una carta preciona 1, si desea parar preciona 6:') if op == 1: suma1 = 0 valorJ = 0 valorK = 0 valorQ = 0 valorAs = 0 print '\n Turno de jugador 1' eleccion = random.choice(cartas) print 'Carta-----', eleccion if eleccion == 'AS': valorAS = int(input('Que valor desea darle a el AS 1 o 10?:')) jugador1.append(valorAS) elif eleccion == 'J': jugador1.append(10) elif eleccion == 'Q': jugador1.a...

Juego de Nicol y Hugo

# coding=utf-8 """ BATALLA NAVAL Representación de cómo se verá el juego COMPUTADORA JUGADOR 1 2 3 4 1 2 3 4 1[*][ ][ ][*] 1[ ][*][ ][ ] 2[ ][*][ ][ ] 2[ ][ ][ ][ ] 3[ ][ ][ ][ ] 3[ ][ ][*][ ] 4[ ][*][ ][ ] 4[*][*][ ][ ] """ import random, copy, time, textwrap # copy nos proporciona operaciones genericas de copiado # Declaración de constantes. DIMENSION_ = 6 TURNO_ = 4 # Imprime el mapa def __imprimir_mapa__(jugador, mesa, dimension): player = 'la computadora' if jugador == 'u': player = 'el jugador' print "\033[1m"+ 'La mesa de ' + player + ' se ve así:' + "\033[0m" # Imprimir el número de columna for i in range(dimension): print ' ' + str(i+1) + '', print ' ' ...

Juego de Cassandra y Brandon

Imagen
# -*- coding: utf-8 -*- #JUEGO DE PIEDRA PAPEL TIJERAS import random jugando = True #Mientras jugando sea verdad seguira corriendo anch = 80 ast = anch * '*' print(ast) print ("\033[1m" + "BIENVENIDO AL JUEGO DE PIEDRA, PAPEL O TIJERA" + "\033[0m") print "Instrucciones: Escribe una de las 3 opciones como se indica 'Piedra' 'Papel' 'Tijera'" while jugando: anch = 80 ast = anch * '*' print(ast) print("\033[1m" + "Piedra, Papel O Tijera" + "\033[0m") pc = random.choice(["Piedra", "Papel","Tijera"])#randint para numeros 1 a 3 player = raw_input("Escriba la opcion que desee: ").capitalize() #Capitalize respeta mayusculas y minusculas #CONDICIONES if player == "Piedra": if pc == "Piedra": print ("PC elije 'Piedra'. Es un Empate....

Juego de David y Alberto

Imagen
# -*- coding: utf-8 -*- import random from time import sleep print "Bienvenido al juego de piedra, papel o tijera." print "" sleep(2) print "Por defecto ganara el mejor de tres, pero lo puedes cambiar." sleep(1) print "" # Funcion de la lógica del juego def juego(intentos): x = 0 jugador = 0 pc = 0 while str(x) != intentos: print "Piedra, papel o tijera?" opc = raw_input() opc = opc.lower() azar = random.choice(["piedra", "papel", "tijera"]) if opc == azar: print "La computadora tambien elijio", azar print "" elif azar == "tijera" and opc == "papel": x += 1 pc += 1 print "El PC saco", azar print "Tu", jugador, "PC", pc print "" elif azar ...

Ejemplos de compañeros en clase

Imagen
EJEMPLOS DE HUGO: print("Comienzo") for i in range(3): print"Hola ", print print("Final") i = 10 print"El bucle no ha comenzado. Ahora i vale ", i for i in [0,1,2,3,4]: print i, " * ", i, " = ", i ** 2 print"El bucle ha terminado. Ahora i vale ", i EJEMPLOS BRANDON from __future__ import print_function print("Comienzo") for i in range(3) : print("Hola ",end="") print() print("Final") # future-fstrings # -*-coding: future_fstrings 3-*- print("Comienzo") for numero in [0,1,2,3]: print (f"{numero} * {numero} = {numero** 2}") print("final") EJEMPLO MOLINA nombre="Luis" for conteo in range(len(nombre)): print conteo print nombre[conteo]

practicas

Imagen
def aumenta4(inicio, fin): i = inicio for i in range(inicio, fin+1, 4): print i inicio = int(input("Ingresa el numero inicial: ")) fin = int(input("Ingresa el numero final: ")) aumenta4(inicio,fin) def aumenta4(inicio, fin,incremento): for i in range(inicio, fin, incremento): print i if i + incremento == fin: print fin inicio = int(input("Ingresa el numero inicial: ")) fin = int(input("Ingresa el numero final: ")) incremento = int(input("Ingrese la cantidad que se incrementara: ")) aumenta4(inicio,fin,incremento) def aumenta4(inicio, fin): while inicio <= fin: print inicio inicio = inicio + 4 inicio = int(input("Ingresa el numero inicial: ")) fin = int(input("Ingresa el numero final: ")) aumenta4(inicio,fin) def sacarparimpar(numeroin, numerofin): while numeroin <= numerofin: residuo = numeroin % 2 if residuo ...

Practicas con bucle for

Imagen
El bucle  for En general, un bucle es una estructura de control que repite un bloque de instrucciones. Un bucle  for  es un bucle que repite el bloque de instrucciones un número predeterminado de veces. El bloque de instrucciones que se repite se suele llamar cuerpo del bucle y cada repetición se suele llamar iteración. La sintaxis de un bucle  for  es la siguiente: for variable in elemento iterable (lista, cadena, range, etc.): cuerpo del bucle No es necesario definir la variable de control antes del bucle, aunque se puede utilizar como variable de control una variable ya definida en el programa. # Bucle for for i in [1,2,3,4,5]: print("Hola mundo") print("comienzo") for i in []: print("Hola ") print print("Final") print("Comienzo") for i in [1, 1, 1]: print("Hola ") print print("Final") print("Comienzo") for _ in [0, 1...

instalacion de libreria con PIP

Imagen
escribir pip install wxPython

EXPLICACION DAVID REPL.IT

EXPLICACION VICTOR GITHUB

EXPLICACION ALFREDO

def notas(nota): if nota >=0 and nota <=3: return "insuficiente" elif nota >=4 and nota <=6: return "suficiente" elif nota >=7 and nota<=10: return "bien" nota= input("ingrese la nota: ") print notas(nota)