P

@Puvi0707

Relational operators

Python
4 years ago
X = 10 y = 20 print(str(x)+"<"+str(y)+"="+str(x<y)) print (str(x)+"== "+str(y)+"="+str(x==y)) print(str(x)+"="+str(y)+"="+str(x!=y)) print(str(x)+">+str(y)+""+str(x>y)) print (str(x)+"="+str(y)+"="+str(x>=y)) print (str(x)+" <= "+str(y)+"="+str(x

+,-,*,/ by 2 floating point

Python
4 years ago
numl= float (input("Enter two numbers: ")) num2= float (input("Enter two numbers: ")) add res numi+num2 sub res numi+num2 mul res num1*num2 div_resnuml/num2

+,-,*,/ by 2 integers

Python
4 years ago
num1 int(input("Enter two numbers: ")) num2 = int(input("Enter two numbers: ")) add_res num1+num2 sub_res= num1+num2 mul res num1 num2

Herons formula

Python
4 years ago
a= float (input("Enter the first side of the triangle : ")) b = float (input("Enter the second side of the triangle: ")) c=float(input ("Enter the third side of the triangle: ")) print(a,b,c) s=(a+b+c)/2 area=(s*(s-a)*(s-b)*(s-c))**0.5 print ("area

Hexadecimal

Python
4 years ago
num int(input("Enter a number : ")) print("Hexadecimal of str(num) + + str(hex(num))) print("Octal of str(num) + " *+ str(oct (num))) print("Square root of + str(num) +: " + str(num* *8.5))

Factorial

Python
4 years ago
def factorial(x): if (x==1): return 1 else: return(x*factorial (x-1)) num=5 print ("the factorial of","num","is", factorial(num))

With argument

Python
4 years ago
def data(name): print("name:",name) return data(name="archana")

Without argument

Python
4 years ago
def hello(): print ("hello python") return hello()

Operator

Python
4 years ago
a=114 b=123 print (a+b) print (a-b) print (a*b) print (a//b) print (a/b)

String

Python
4 years ago
str1="archana" str2="jk" print (str1+str2) print(str1*4) print (str1[0:3])

Prog to reverse of no

Python
4 years ago
num=int(input("enter the number:")) print("the reversed number is:")) while(num!=0): temp=num%10 print(temp,end="") num=int(num/10)

Prog to binary to decimal

Python
4 years ago
1-0 binary nun- Intrepit("Enter the binary saber (7)) decimal nume while(binary nunt+0); remainder binary nude decimal nus decinal_merenainder d 2 p^ * |2^ * +1 binary =1 pi t[81 pi ar - x = 1 * 1 print("The decimal equivalent is,decimal m)

Prog to Armstrong no

Python
4 years ago
num=n while(n!=0): r=n%10 s=s+(r*r*r) n=int(n/10) if(s==num): print("the number is Armstrong") else: print("the number is not Armstrong")

Prog to sum of its digit

Python
4 years ago
sumofdigits=0 num=int(input("enter the number:")) while(num!=0): temp=num%10 sumofdigits=sumofdigits+temp num=num/10 print("the sum of digits is:",sumofdigits)

Prog to 20 hori *

Python
4 years ago
i=1 while(i<=20): print("*",end="") i=i+1

Prog to sum and average calculate

Python
4 years ago
i=0 s=0 while(i<=10): s=s+i i=i+1 avg=float(s)/10 print ("the sum of first 10 numbers is:",s) print("the average of first 10 numbers is:",avg)

Prog to print1st 10 nos using while loop

Python
4 years ago
i=0 while(i<=10): print(i,ends="") i=i+1

Prog to great of nos 3nos

Python
4 years ago
num1=int(input("enter the first number:")) num2=int(input("enter the second number:")) num3=int(input("enter the third number:")) if(num1>num2): if(num1>num3): print(num1,"is greater than",num2,"and",num3) else: print

Prog to determine the char vowel or not

Python
4 years ago
ch=input("enter any character:") if(ch=="A" or ch=="E" or ch="I" or ch="O" or ch"U"): print(ch,"is a vowel ") elif(ch=="a" or ch=="e" or ch=="i" or ch=="o" or ch=="u"): print(ch,"is a vowel") else: print(ch,"is not a vowel")

Prog to test a no is -ve,+ve,equal or 0

Python
4 years ago
num=int(input("enter any number :")) if(num==0): print("the value is equal to zero") elif(num>0): print ("the number is positive") else: print("the number is negative")