This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Question 1: | |
| a=int(input("Enter the number")) | |
| if a>0: | |
| print("Positive number") | |
| elif a<0: | |
| print("Negative Number") | |
| else: | |
| print("Zero") | |
| #output |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #The variables ph1 to ph10 represents 10 different real-time phishing emails. | |
| from collections import Counter | |
| ph1= ["Robocalls are on the rise. Be wary of any pre-recorded messages you might receive"] | |
| ph2=["our access to your library account is expiring soon due to inactivity. To continue to have access to the library services account, you must reactivate your account. For this purpose, click the web address below or copy and paste it into your web browser. A successful login will activate your account and you will be redirected to your library profile"] | |
| ph3=["We detected unknown IP access on our date base computer system our security requires you to verify your account for secure security kindly Click Here and verify your account"] | |
| ph4=["Password will expire in 2 days Click Here To Validate E-mail account"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 5a) | |
| x=int(input("Enter base value")) | |
| n=int(input("Enter Power value")) | |
| print("x pow of n ->",x**n) | |
| Output: | |
| Enter base value2 | |
| Enter Power value3 | |
| x pow of n -> 8 | |
| ------------------------------------------------------------------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from tkinter import * | |
| class MyWindow: | |
| def __init__(self, win): | |
| self.lbl1=Label(win, text='First number') | |
| self.lbl2=Label(win, text='Second number') | |
| self.lbl3=Label(win, text='Result') | |
| self.t1=Entry(bd=3) | |
| self.t2=Entry() | |
| self.t3=Entry() | |
| self.btn1 = Button(win, text='Add') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| a)Alter table- Add column | |
| mysql> select *from student3; | |
| +--------+----------+-------+-------+ | |
| | rollno | Name | CLASS | MARKS | | |
| +--------+----------+-------+-------+ | |
| | 101 | student1 | 12 | 90 | | |
| | 102 | student2 | 12 | 89 | | |
| | 103 | student3 | 12 | 88 | | |
| | 104 | student4 | 12 | 87 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pymysql as pym | |
| mycon=sqltor.connect(host="localhost",user="root",passwd="tiger",database="gvkcv") | |
| cursor=mycon.cursor() | |
| cursor.execute("select *from student10") | |
| data=cursor.fetchall() | |
| for i in data: | |
| print(i) | |
| mycon.close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import mysql.connector as sqltor | |
| mycon=sqltor.connect(host="localhost",user="root",passwd="tiger",database="gvkcv") | |
| if mycon.is_connected()==False: | |
| print("error connecting to database") | |
| cursor=mycon.cursor() | |
| cursor.execute("select *from student10") | |
| data=cursor.fetchall() | |
| for i in data: | |
| print(i) | |
| mycon.close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Switched to a database | |
| mysql> USE GVKCV; | |
| Database changed | |
| #Creating table student | |
| mysql> create table student | |
| -> (ROLLNO INT NOT NULL PRIMARY KEY, | |
| -> NAME CHAR(10), | |
| -> TELUGU CHAR(10), | |
| -> HINDI CHAR(10), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mysql> create table student4 | |
| -> (rollno int not null primary key, | |
| -> name char(10) not null, | |
| -> class int); | |
| Query OK, 0 rows affected (0.49 sec) | |
| mysql> insert into student4 | |
| -> select rollno,name,class from student3; | |
| Query OK, 4 rows affected (0.17 sec) | |
| Records: 4 Duplicates: 0 Warnings: 0 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder