About Python, Python Introduction, What is Python:-






Python is a script based language which will be executed by Python interpreter itself.
The python script is easy to learn and light-weight script as compare to other programming languages.
A python script was developed by GUIDO VAN RASSUM to create a Device driver-based application initially.



but now Python is complete technology which is used to develop System Software, Application Software, Data Science, Machine Learning, Interface Programming, Game Development,
Electronic Software Implementation with IoT and Aurdino, Automation Programming for Software Testing.



Python Script performance is best as compare to other languages means its performance is much better as compared to C, CPP, Java, PHP, and Another Programming language.
Python script only focuses on a set of code .it not use code pattern and code structure.


.....................................................................................................................................................

How we run the Python Script:-


1 Online Mode:-


We can run a python script without using any software because of Python Software tools are online available.

www.jupyter.org/try

Python Program for Addition


........................................................................................................

Offline Mode:-

python.org  download python software

python 3.7.4.exe file will be downloaded from here

double click and execute them.

After Successfully installation Python Provide Default IDLE Tools
...............................................................................................................................................................

Python Program Execution:-

1 Python Source Code ------> Run  -----> PYTHON INTERPRETER MACHINE ----> Machine Code----> Output

.....................................................................................................................................

Program to calculate simple interest?

p,r,t=12000,2.2,3.5
si=(p*r*t)/100
print("result is p={0} , r={1} , t={2} ,si={3} ".format(p,r,t,si))
#print("result is %.2f" % si)






Input /Output function for Python Console Application:-


Output Function

print():-   it is used to print a single line statement and multiple line statements both.
print("hello")    #single statement
print("hello","world")  #Multiple Statement
print("hello" + "world")  #Conacatenation
print(" %f " %  1.2345)


input():-  it is used to take input from the user's.

var=input("message") 

input return data in String format


a= int(input("message"))
#program for addition
a=int(input("enter first number"))
b=int(input("enter second number"))
c=a+b
print(c)

#ASSIGNMENT:-

WAP to Calculate the Area of Triangle and Rectangle?

WAP to Reverse Five Digit Number?

WAP to Calculate Addition of Complex Number?



Solution:-

Reverse Program Answer?
num=78125
print("Actual number is",num)
a=num%10  #5
num=num//10 #1234
b=num%10    #4
num=num//10 #123
c=num%10    #3
num=num//10 #12
d=num%10    #2
e=num//10   #1
num1= a*10000+b*1000+c*100+d*10+e*1
print("Reverse of number is",num1)


Addition of complex numbers without using complex()?

r1 = 2
i1 = 3
r2=5
i2=7
r = r1+r2
i = i1+i2
print("{0}+{1}j".format(r1,i1))
print("{0}+{1}j".format(r2,i2))
print("{0}+{1}j".format(r,i))

Addition of a complex number with a complex number:-

num1 = 2+3j
num2 = 4+5j
num = num1+num2
print(num1)
print(num2)
print(num)



Post a Comment

If you have any doubt in programming or join online classes then you can contact us by comment .

Previous Post Next Post