Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is for my python/sql class 1. Which strings will be matched by the regular

ID: 3733852 • Letter: T

Question

This is for my python/sql class

1. Which strings will be matched by the regular expression "[^A-Z]*" ? (select all that applies)

aaa

Hello

F16

best

2. Which strings will be matched by the regular expression "re-+sign"? (select all that applies)

resign

re-sign

re-*sign

re--sign

3. Complete the code below to create the table users with attributes name (a max of 30 variable length characters), address (a max of 50 variable length characters), and age (an integer) in the database "testdb":

import MySQLdb

con = MySQLdb.connect(db='testdb')

A.

aaa

B.

Hello

C.

F16

D.

best

Explanation / Answer

Answer 1: Option A and D

Because regex [^A-Z] means, accept anything except characters mentioned in square brackets. So it will reject all strings having capital letters.

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

Answer 2: Option B and D

Because in regex "re-+sign" , + means 1 or more occurences of previous character.

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

Answer 3:

import MySQLdb

con = MySQLdb.connect(db='testdb')

# prepare cursor object

cursor = con.cursor()

# use execute() method to run SQL query

sql = """CREATE TABLE USERS(

NAME VARCHAR(30),

ADDRESS VARCHAR(50),

AGE INT)"""

cursor.execute(sql)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote