Example #1
0
    plt.waitforbuttonpress(1)


if __name__ == "__main__":
    # Ignore warnings
    warnings.filterwarnings("ignore")

    # Run tests
    test_runner = TestRunner()
    results = test_runner.run()

    if results.failures:
        exit()
    sleep(0.1)

    product_values = products()
    requirement_values = requirements()

    print('Selected products:')
    for prod_num, prod in enumerate(product_values.keys()):
        print(f'Product: {prod_num+1}, {prod}')
        print('\n'.join([f'{key} : {value}' for key, value in product_values[prod].items()]))
        print('')

    print('Requirements:')
    for req_name, req in requirement_values.items():
        print(f'{req_name} : {req[0]} - {req[1]}')
    print('')

    print('Does diet exist?')
    problem, objective, status = solve_diet_exists(product_values, requirement_values)
Example #2
0
import cgi
import pymysql
import header
import content

form = cgi.FieldStorage()

name = form.getvalue('u_name')
email = form.getvalue('u_email')
pwd = form.getvalue('u_pwd')
mobile = form.getvalue('u_num')
city = form.getvalue('u_city')

connection = pymysql.connect(host='localhost',
                             port=3306,
                             user='******',
                             db='e_comm2',
                             autocommit=True)

cursor = connection.cursor()

query = "INSERT INTO users VALUES (%s, %s, %s, %s, %s)"
cursor.execute(query, (name, email, pwd, mobile, city))

reg = True
header.head(reg, name)
content.products()