OVA

OVA
-- phpMyAdmin SQL Dump
-- version 4.6.4
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 16-09-2019 a las 21:08:04
-- Versión del servidor: 5.7.14
-- Versión de PHP: 5.6.25

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Base de datos: `ova`
--

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `modulo`
--

CREATE TABLE `modulo` (
  `Id_Modulo` int(10) NOT NULL,
  `Titulo` varchar(30) NOT NULL,
  `Actividades` varchar(50) NOT NULL,
  `Video` varchar(50) NOT NULL,
  `Texto` varchar(50) NOT NULL,
  `Presentacion` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `resultados`
--

CREATE TABLE `resultados` (
  `Valor` int(11) NOT NULL,
  `Id_Usuario` int(250) NOT NULL,
  `Id_Modulo` int(250) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `roles`
--

CREATE TABLE `roles` (
  `Id_Rol` int(10) NOT NULL,
  `Nombre` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `usuarios`
--

CREATE TABLE `usuarios` (
  `Id_Usuario` int(5) NOT NULL,
  `Nombre` varchar(25) NOT NULL,
  `Correo` varchar(25) NOT NULL,
  `Password` varchar(32) NOT NULL,
  `Id_Rol` int(250) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Índices para tablas volcadas
--

--
-- Indices de la tabla `modulo`
--
ALTER TABLE `modulo`
  ADD PRIMARY KEY (`Id_Modulo`);

--
-- Indices de la tabla `resultados`
--
ALTER TABLE `resultados`
  ADD KEY `fk_Id_Usuario` (`Id_Usuario`),
  ADD KEY `fk_Id_Modulo` (`Id_Modulo`);

--
-- Indices de la tabla `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`Id_Rol`);

--
-- Indices de la tabla `usuarios`
--
ALTER TABLE `usuarios`
  ADD PRIMARY KEY (`Id_Usuario`),
  ADD KEY `fk_Id_Rol` (`Id_Rol`);

--
-- Restricciones para tablas volcadas
--

--
-- Filtros para la tabla `resultados`
--
ALTER TABLE `resultados`
  ADD CONSTRAINT `fk_Id_Modulo` FOREIGN KEY (`Id_Modulo`) REFERENCES `modulo` (`Id_Modulo`),
  ADD CONSTRAINT `fk_Id_Usuario` FOREIGN KEY (`Id_Usuario`) REFERENCES `usuarios` (`Id_Usuario`);

--
-- Filtros para la tabla `usuarios`
--
ALTER TABLE `usuarios`
  ADD CONSTRAINT `fk_Id_Rol` FOREIGN KEY (`Id_Rol`) REFERENCES `roles` (`Id_Rol`);

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

Ingresar datos documento txt Python

Ingresar datos documento txt Python
def crear():
    archivo=open("datos.txt","w")
    archivo.close()
   
 
def escribir():
    archivo=open("datos.txt","a")
    nombre = str(input("ingrese el nombre"))
    apellido = str(input("Ingrese el apellido"))
    archivo.write(nombre+","+apellido+"\n")
    archivo.write("Fin Del Archivo")
    archivo.close()
def leer():
    archivo=open("datos.txt","r")
    registro=archivo.readline()
    while registro!="":
          print(registro)
          registro=archivo.readline()
    archivo.close()
def leerlista():
    archivo=open("datos.txt","r")
    registros=archivo.readlines()
    for lineas in registros:
        print(registros)
         
#crear()
#escribir()
leer()
leerlista() 

BUSCAMINAS 100%REAL NO FAKE

BUSCAMINAS 100%REAL NO FAKE
import random

matriz = []
jugadas = []
coins = 5
x = 1
row = 0
col = 0
puntaje = 0

for i in range(4):
    matriz.append([])
    for j in range(4):
        matriz[i].append(random.randint(0, 1))
        
print("Buscaminas")
#print(matriz)1

while x <= coins :
    valid = False
    
    print("\nJugadas restantes " + str(coins - x + 1))
    row = int(input("Ingrese fila: \n"))
    while row > 4 or row < 1 :
        print("No puede ser mayor de 4 y menor de 1 \n")
        row = int(input("Ingrese fila: \n"))
    col = int(input("Ingrese columna \n"))
    while col > 4 or col < 1:
        print("No puede ser mayor de 4 y menor de 1 \n")
        col = int(input("Ingrese fila: \n"))
    play = matriz[row - 1][col - 1]
    
    if (len(jugadas) == 0) :
        valid = True
    else :
        for k in range(len(jugadas)) :
            fila = jugadas[k][0] == row
            columna = jugadas[k][1] == col
            validate = fila and columna
            valid = not validate
            if (not valid) :
                break
             
    if valid == True : 
        jugadas.append([row,col])
        if (play == 0) :
            puntaje = puntaje - 2
        else :
            puntaje = puntaje + 4
    else :
        print("Por favor repita la jugada")
        coins = coins + 1
        
    #print("Puntaje parcial = " + str(puntaje))
    x = x + 1
    
print("Puntaje total: " + str(puntaje))
print(matriz)
print(jugadas)

buscaminas v beta

buscaminas v beta
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 20 18:28:21 2019

@author: 303
"""

import random as rd

n=4
m=4
matriz=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]]
matriz2=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]]

for i in range(n):
    for j in range(m):
        matriz[i][j]=rd.randrange(0,2)

matriz2=matriz
print("matriz original")
for i in range(n):
    for j in range (m):
        print(matriz[i][j],end="")
    print(end="\n")
print("matriz copiada")
for i in range(n):
    for j in range (m):
        print(matriz2[i][j],end="")
    print(end="\n")
con=0
con2=0
a=0
b=0
seguro=0
mina=0
contaseguro=0
contamina=0
while con<10:
    a=int(input("Que posicion de la columna "))
    b=int(input("Que posicion de la fila "))
    if matriz[a][b] == 0:
        mina-=2
        contamina+=1
        matriz[a][b]=5
    else:
        seguro+=4
        contaseguro+=1
        matriz[a][b]=6
        if matriz[a][b] == 5:
            print("Ingrese otro valor")

    con+=1

print("matriz original")
for i in range(n):
    for j in range (m):
        print(matriz2[i][j],end="")
    print(end="\n")
print("el numero de minas: ",contamina)
print("el numero de seguros: ",contaseguro)
print("suma de puntos :",(seguro+mina))

21 para dos jugadores en phyton

21 para dos jugadores en phyton
# -*- coding: utf-8 -*-
"""
Editor de Spyder

Este es un archivo temporal.
"""
import random as rd


f=0

while f<=21:
    print("Jugador 1")
    a=rd.randrange(1,12)
    b=rd.randrange(1,12)
    c=a+b
    print("carta 1 =",a)
    print("carta 2 =",b)
    print("Lleva en total =",c)
    d=int(input("Ingrese 1: para pedir otra carta o 2: para parar ="))

    if d==1:
        e=rd.randrange(1,12)
        c+=e
        f=c
        print("su carta es =",e )
        print("lleva en total =",c)
    else:
        while f<=21:
            print("Jugador 2")
            a=rd.randrange(1,12)
            b=rd.randrange(1,12)
            c=a+b
            print("carta 1 =",a)
            print("carta 2 =",b)
            print("Lleva en total =",c)
            d=int(input("Ingrese 1: para pedir otra carta o 2: para parar ="))
            if d==1:
                e=rd.randrange(1,12)
                c+=e
                f=c
                print("su carta es =",e )
                print("lleva en total =",c)