Вы находитесь на странице: 1из 4

# print function used to print on python conosle

print("good morning disha");


a=100; # integer
f=12.90 # float
name="disha" # string
alpha='A' # character

#multiple line comments

'''sdjhgfskjdhgksdhgkj
jflskjglsdjglk
ljgsdlfkjgdfkljgkdlfj'''

print(a)
print(f)
print(name)
print(alpha)

# write a program to find area of circle


# pi*(r*r)
pi=3.14;
r=float(input("Enter radious=> "))

circle=pi*(r**2)
print(circle)

# comparision operators

a=100
b=200
c=a<=b # true or false
print(c)

'''
< less than true
<= less or equal true
> greater than true
>= grater or equal true
== just equal
!= not equal
=== equal & checks datatypes as well

sal=12000

C= sal>=10000 or sal <=25000

con1 con2 result


And true true true
And true false false
And false true false
And false false false

con1 con2 result


OR true true true
or true false true
or false true true
or false false false

And & or operator always need atleast 2 conditions


but for not only 1 condition is required

a=true
b=!a #false
a=!(100<500) #false

# write a program to check user entered number is odd or even

num=int(input("Enter number => "))

if num%2 == 0: #condition
#condition true
print("even number")
else:
#condition false
print("odd number")

#main block statement


print("out side if ....")

# addition of two integer variable


a=100
b=200

add=a+b;

print(a);
print(b);
print(add);

# addition of two integer variable


a=100
b=200

add=a+b;

print(a);
print(b);
print(add);

#Modulo Example

a=115
mod=a%10
print(mod)
#write a program to print 1 to 10 numbers
count =1 #init
while count<=10:
print(count)
count=count+1

# write a program to print odd number


count =1 #init
while count<=10:
if count%2!=0:
print(count)
count=count+1
else:
count=count+1

#School report program

m= 65
p= 56
b= 78
c= 73
e= 62
percentage=((m+p+b+c+e)/500*100)
print (percentage)

if (percentage <35):
print("fail")
elif (percentage >=35 and percentage <50):
print ("third class")
elif (percentage >=50 and percentage<60):
print ("second class")
elif(percentage >=60 and percentage <70):
print ("first class")
else:
print ("distiction")

# Simple Interest= amout*year*rate/100

amount=float(input("Enter amount => "))


r=float(input("Enter Rate => "))
y=float(input("Enter Year => "))

si=amount*r*y/100

print(si);

''' arithmetic +,-,/,*,//,**


constional operator <,>,<=,>=,==,!=,===
a=10
b="10"

c=a==b #true
c=a===b # false

# String is collection of characters

name="Disha"
print(name[0])

mul=name*3
print(mul)

fullname=name + " Pawar "


print(fullname)

statement ="i love india ,its my india";


c=statement.count('India',0,13);
print(c)

print(statement.find('india'));

Вам также может понравиться