Category : random

Problem: please why can’t I write to mysql repeatedly via — for f in range(10):? import mysql.connector from mysql.connector import Error import random mydb = mysql.connector.connect( host="localhost", user="db123", password="1111", database="db123" ) mycursor = mydb.cursor() #sql = "INSERT INTO customers (c1, c2, c3, c4, c5, d1, d2) VALUES (%s, %s, %s, %s, %s, %s, %s)" sql ..

Read more

How do I identify if a randomly selected variable is in a list? Python 3 Example: WarriorList = [‘Achilles’, ‘Sun Wukong’] GuardianList = [‘Ares’, ‘Ymir’] HunterList = [‘Apollo’, Artemis’] MageList = [‘Anubis’, ‘ra’] Tank = () def TankPick(): Tank = (random.choice(WarriorList)) print (Tank) def BalancePick(): if (Tank) in WarriorList: print (‘yes’) print (random.choice(Magelist)) else: print ..

Read more