Phython Project Class 11th
Phython Project Class 11th
# printing types
print("type(a): ", type(a))
print("type(b): ", type(b))
print("type(c): ", type(c))
# printing values
print("value of a: ", a)
print("value of b: ", b)
print("value of c: ", c)
Output
2)Python program to define an integer
value and print it
# print num
print "num =",num
# print using format
print "num = {0}".format(num)
# print num
print "num =",num
# print using format
print "num = {0}".format(num)
Output
Output
a = 10
b = 3
# addition
result = a+b
print("a+b :", result)
# subtraction
result = a-b
print("a-b :", result)
# division
result = a/b
print("a/b :", result)
# modulus
result = a%b
print("a%b :", result)
# exponent
result = a**b
print("a**b :", result)
# floor division
result = a//b
print("a//b :", result)
Output
Output
Output
Output
Output
Output
if a==10:
print("Equal to 10")
else:
print("Not Equal to 10")
Output
Example 2: Find largest of two numbers
a=int(input("Enter A: "))
b=int(input("Enter B: "))
if a>b:
g=a
else:
g=b
print("Greater = ",g)
Output
# input age
age = int(input("Enter Age : "))
Output
12)Python program to calculate
discount based on the sale amount
print("Discount : ",disc)
print("Net Pay : ",amt-disc)
else:
print("Invalid Amount")
Output
13)Python Looping
Table of number:-
n=int(input("Enter N: "))
for i in range(1,11):
print(n,"x",i,"=",i*n)
Output
for i in range(1,n+1):
print(i)
Output
# Main code
# input a number
number = int(input("Enter an integer number: "))
Output