diff --git a/Loops/tempCodeRunnerFile.py b/Loops/tempCodeRunnerFile.py index a6ad39b..3e262f8 100644 --- a/Loops/tempCodeRunnerFile.py +++ b/Loops/tempCodeRunnerFile.py @@ -1,2 +1,8 @@ +x = input('Enter any number ') +sum = 0 +for i in x: + y = int(i) + a = y**3 + sum = sum+a - i = i+1 \ No newline at end of file +print(sum) \ No newline at end of file diff --git a/database/12CS/delete_row.py b/database/12CS/delete_row.py new file mode 100644 index 0000000..e85ca73 --- /dev/null +++ b/database/12CS/delete_row.py @@ -0,0 +1,6 @@ +import MySQLdb +db = MySQLdb.connect('localhost', 'root', '', 'davschool') +cursor = db.cursor() +cursor.execute('delete from games where id=6') +db.close() +print('record deleted') diff --git a/database/12CS/insert_row.py b/database/12CS/insert_row.py new file mode 100644 index 0000000..70c9ae7 --- /dev/null +++ b/database/12CS/insert_row.py @@ -0,0 +1,6 @@ +import MySQLdb +db = MySQLdb.connect('localhost', 'root', '', 'davschool') +cursor = db.cursor() +cursor.execute('insert into games values (6,"Python fun")') +db.close() +print('Record added successfully') diff --git a/database/12CS/multiple_row.py b/database/12CS/multiple_row.py new file mode 100644 index 0000000..e609a3b --- /dev/null +++ b/database/12CS/multiple_row.py @@ -0,0 +1,9 @@ +import MySQLdb +db = MySQLdb.connect('localhost', 'root', '', 'davschool') +cursor = db.cursor() +cursor.execute('select id,gname from games') +game_name = cursor.fetchall() +print('Your Game is :', game_name) +print('Game Id :', game_name[0]) +print('Game name :', game_name[1]) +db.close() diff --git a/database/12CS/select_single_word.py b/database/12CS/select_single_word.py new file mode 100644 index 0000000..dd6af77 --- /dev/null +++ b/database/12CS/select_single_word.py @@ -0,0 +1,7 @@ +import MySQLdb +db = MySQLdb.connect('localhost', 'root', '', 'davschool') +cursor = db.cursor() +cursor.execute('select gname from games where id=6') +game_name = cursor.fetchone() +print('Your Game is :', game_name) +db.close() diff --git a/database/12CS/single_row.py b/database/12CS/single_row.py new file mode 100644 index 0000000..19d5a34 --- /dev/null +++ b/database/12CS/single_row.py @@ -0,0 +1,9 @@ +import MySQLdb +db = MySQLdb.connect('localhost', 'root', '', 'davschool') +cursor = db.cursor() +cursor.execute('select id,gname from games where id=6') +game_name = cursor.fetchone() +print('Your Game is :', game_name) +print('Game Id :', game_name[0]) +print('Game name :', game_name[1]) +db.close() diff --git a/database/12CS/tempCodeRunnerFile.py b/database/12CS/tempCodeRunnerFile.py new file mode 100644 index 0000000..19d5a34 --- /dev/null +++ b/database/12CS/tempCodeRunnerFile.py @@ -0,0 +1,9 @@ +import MySQLdb +db = MySQLdb.connect('localhost', 'root', '', 'davschool') +cursor = db.cursor() +cursor.execute('select id,gname from games where id=6') +game_name = cursor.fetchone() +print('Your Game is :', game_name) +print('Game Id :', game_name[0]) +print('Game name :', game_name[1]) +db.close() diff --git a/database/12CS/update_record.py b/database/12CS/update_record.py new file mode 100644 index 0000000..564dfa0 --- /dev/null +++ b/database/12CS/update_record.py @@ -0,0 +1,6 @@ +import MySQLdb +db = MySQLdb.connect('localhost', 'root', '', 'davschool') +cursor = db.cursor() +cursor.execute('update games set gname ="fun with python " where id=6') +db.close() +print('Record updated successfully') diff --git a/database/arushi.py b/database/arushi.py new file mode 100644 index 0000000..4b361d3 --- /dev/null +++ b/database/arushi.py @@ -0,0 +1,5 @@ +import MySQLdb +db = MySQLdb.connect('localhost', 'root', '', 'davschool') +cursor = db.cursor() +cursor.execute('insert into games values (6,"Python fun")') +db.close() diff --git a/database/games_insert.py b/database/games_insert.py new file mode 100644 index 0000000..57157c3 --- /dev/null +++ b/database/games_insert.py @@ -0,0 +1,5 @@ +import MySQLdb +db = MySQLdb.connect('localhost', 'root', 'ramji', 'davschool') +cursor = db.cursor() +cursor.execute('insert into games values(7,"cricket-new",750 )') +db.close()