Hello Friends.
In Our Previous Blog, We have Learned the Basics of Python Programming Language & Different Program in Python Programming Language.
In Today's Blog We Will Create Some Basic Methods In Python Programming Language.
In Our Previous Blog, We have Learned the Basics of Python Programming Language & Different Program in Python Programming Language.
In Today's Blog We Will Create Some Basic Methods In Python Programming Language.
Create Some Different Methods in Python Programming Language.
Program
#Create Different Methods In Python Programming Language.
def swap(a,b):
a=a+b
b=a-b
a=a-b
print("First Value = ",a)
print("Second Value = ",b)
def arth():
c=a+b
print("Addition = \t",c)
c=a-b
print("Substraction = \t",c)
c=a*b
print("Multiplication = ",c)
c=a//b
print("Division = \t",c)
c=a%b
print("Reminder = \t",c)
def comp():
if a>b:
print("First Value is Greater = \t",a)
elif b>a:
print("Second Value is Greater = \t",b)
else:
print("Both Value are Equal = \t",a)
f1="#################"
a=int(input("Enter First Value = \t"))
b=int(input("Enter Second Value = \t"))
print(f1)
print("Which operation do you want to perform on two variables?")
dict={1:'Swapping Two Digit',2:'Arthmetic Operations',3:'Compare Two Variable'}
for key in dict:
print(key,' - ',dict[key])
print(f1)
x=int(input("Choose any One = \t"))
if x==1:
swap(a,b)
elif x==2:
arth()
elif x==3:
comp()
else:
x=int(input("Please Enter Right Digit = \t"))
if x==1:
swap()
elif x==2:
arth()
elif x==3:
comp()
else:
x=int(input("\t Run This Program Again \t"))
Output-I
Enter First Value = 45
Enter Second Value = 54
#################
Which operation do you want to perform on two variables?
1 - Swapping Two Digit
2 - Arthmetic Operations
3 - Compare Two Variable
#################
Choose any One = 1
First Value = 54
Second Value = 45
Output-II
Enter First Value = 55
Enter Second Value = 5
#################
Which operation do you want to perform on two variables?
1 - Swapping Two Digit
2 - Arthmetic Operations
3 - Compare Two Variable
#################
Choose any One = 2
Addition = 60
Substraction = 50
Multiplication = 275
Division = 11
Reminder = 0
Output-III
Enter First Value = 33
Enter Second Value = 22
#################
Which operation do you want to perform on two variables?
1 - Swapping Two Digit
2 - Arthmetic Operations
3 - Compare Two Variable
################
Choose any One = 3
First Value is Greater = 33
If You want to Know the Basics of Python Programming Language then Click On this Link.
- Learn Basics of Python
- Learn Hello-World Program in Python
- Learn Swapping Program in Python
- Learn Palindrom Number Program in Python
- Learn Prime Number Program in Python
- Learn about Loops & his Program Example
- Learn How to Find Value type in Python
- Learn A Basic Project in Python
- Learn Odd & Even Number Program in Python
- Learn Python Programming....
- Different Shapes of Pyramid
If You want to Know about Information Technology or It Technology, Then Click on the Link given above.
If you want to see Our Privacy Policy then You Can Click on this Link.
Amazing ๐
ReplyDelete