0% found this document useful (0 votes)
2 views

python codes

The document contains a Python script that performs various tasks including grade classification based on marks, finding the greatest of three numbers, user authentication, vowel checking, quadratic equation root calculation, and type checking of different data types. It also includes function definitions for summing three numbers and displaying a decorative line. The script demonstrates basic programming concepts such as conditionals, loops, and function definitions.

Uploaded by

dammuniranjan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

python codes

The document contains a Python script that performs various tasks including grade classification based on marks, finding the greatest of three numbers, user authentication, vowel checking, quadratic equation root calculation, and type checking of different data types. It also includes function definitions for summing three numbers and displaying a decorative line. The script demonstrates basic programming concepts such as conditionals, loops, and function definitions.

Uploaded by

dammuniranjan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

import math

marks=(int)(input("enter marks"))

if marks >= 60:

print("first class")

elif marks >= 50:

print("second class")

elif marks>= 35:

print("third class")

else:

print("fail")

x = (int)(input("enter number"))

y = (int)(input("enter another"))

z = (int)(input("enter another"))

if x >= y and x >= z:

print(x , "is greatest")

elif y >=x and y >= z:

print(y, "is greatest")

else:

print(z, "is greatest")

uname = input("enter username ")

pwd = input("enter password ")

if uname != "barch" and pwd!= "2sem":

print("both username and password are wrong")

elif uname == "barch" and pwd != "2sem":

print("password is wrong")

elif uname != "barch" and pwd == "2sem":

print("wrong user name")

else:

print("login success")
ch = input("enter any alphabet")

if ch == 'A' or ch == 'E' or ch=='I' or ch == 'O' or ch == 'U':

print("it is a vowel")

else:

print("it is a consonant")

v = [ 'A', 'a', 'E', 'e', 'I', 'i', 'O', 'o', 'U', 'u']

if ch in v:

print("vowel")

else :

print("not a vowel")

a = (float)(input("enter value for a"))

b = (float)(input("enter value for b"))

c = (float)(input("enter value for c"))

d=b*b-4*a*c

if d > 0:

r1 = (-b + math.sqrt(d))/2*a

r2 = (-b - math.sqrt(d))/2*a

print("root1 = ", r1)

print("root2 = ", r2)

elif d==0:

r1 = r2 = - b/2*a

print("root1= ", r1)

print("root2= ", r2)

else:

print("imaginary roots")

f = 89

y = 7.3
k = "tree"

j = [45, 34, 27]

p = { "a": 34, "b":89, "c":55}

w =(3, 4, 2, 8)

t = True

r = 6 +4j

print(type(f))

print(type(y))

print(type(k))

print(type(j))

print(type(p))

print(type(t))

print(type(r))

print(type(w))

n = 89

print(id(n))

def sai_method(x, y, z):

print("the sum is ", x + y + z)

sai_method(45, 67, 89)

sai_method(67, 89, 44)

sai_method(45, 123, 89)

sai_method(77, 67, 89)

sai_method(87, 67, 83)

def disp():

print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")

disp()

disp()

You might also like