Python Problem Facing to make a Program

 

Python Problem Facing to make a Program

 



Q.What is python?

Python is programming language.

 

Python is a simple and easy programming language .It is easy to learn and understand ,it’s grammer very simple .If you know english speaking then you can easily learn python language.Python language is the most popular and demanding language nowadays.

 

 Q.What is scope of python language?

It’s scope is very large ,in every companies private or government there is demand there is most of the work done by python language.I will make some simple program but before that first know about python.

·      It is used to make bar code

·      It is used to make result of any students

·      It is used to make applications

 

Founder of Python : Guido Van Rossoum

Year;1991

How this programming language name is python :By the circus i.e

 

Q.What are the advantages of Python Language?

·      It is very simple to learn.

·      It is easy to learn it syntax

·      It’s coding is very simple in English language

 

Q.What is the problem facing by the beginners?

The begginers think that it is similar like java ,C++ ,HTML language but it is not like this ,there is simple English language that you use in dialy life.Python language and its syntax is very simple to use and to make program.

 

 

The many students do lots of mistake i.e given below :

 

·      Many students they just cope up the programs and paste in practical  exam

·      They not understand its algorithm

·      They never try to make the program  itself of the same questions.

·      They think that this is very hard programming language.

·      They not understand the syntax of any program and they never learn keywords of the python language.

·      They face a problem to make program in looping because  to run the loop i.e for loop or while loop i.e very hard but not impposible ,But many students face problem in looping related program.

 

How to learn python Language to make program?

First thing i.e you have to know about data types of python .that are numeric ,string,list,tuple,and dictionary.

To know more about these data types in detail so click on below link:

 Data Types in Python

 

If you have understood data types,then you have to print any thing

Let us understand using example:

If I say to print Python

 

Way to write a program

#this is a way to print any thing in console screen,you have to use always print() function to print any statement

 

print(“Python”)

# and this is called string

 Similarily If I say print My name is abcd ,then

 

print(“My name is abcd”)

 

If I say take input from the user and that thing print in console screen then

 

Use input() function to take input from the user see below and if you want to write any statement so that user can understand that what you want to say

 

#A is variable i.e identifier

A=input(“Enter any statement”)

print(A)

 

Now if I say to print 3 ,then

print(‘3’)

 

Now If I say take input from the user

N=input(“Enter any number:”)

print(N)

So your output will be in string form ,because you know any thing inside quotes i.e string ,so now you have to convert in number form i.e numeric form so  use int() function to convert given number into integer form,

Eg.

N=int(input(“Enter any number:”)

print(N)

 

Similarily If I say print two number like 2,3 then

 

N=2

A=3

print(N,A)

Then your output will be 2,3

 

Now If I say what is the sum of 2 and 3 then,

N=2

A=3

Sum=N+A

print(Sum)

#Here sum is variable

Then your output will be 5

You can write this is another way i.e

N=2

A=3

 

print(N+A)

then your output will be same,

So similarily you can add more numbers ,subtract the  numbers ,multiply and divide the number using operator like - ,*,/.

Let us understand using example:

Example 1:

A=2

N=3

print(A-N)

Example 2:

A=2

N=3

print(A*N)

 

So now similarily  you can take input from the user

Let us understand using example:

A=int(input(“Enter any first number:”)

N=int(input(“Enter second number:”)

Sum=A+N

print(Sum)

Similarily you can do other mathematical operations.

 

Now I think you have understood upto now.

Simialarily you can do  two string  addition .And to more operations about string ,list ,tuple and dictionary click on below link.

 

Practice Questions:

1)write a program to print sum of three numbers.

2)write a program to print multiplication of two numbers.

 

 

 

 

So now first thing i.e analyse the program and then design the program and convert into programming language.

To analyse-First understand the program and think about inputs are require ,output require.

Design -To design a program you can use flow chart to understand the program.

So to know or understand the program:

We will do dome example:

If I say make a program to print sum of the digits:

Testcases1:

Input:12

Output:

1+2=3

Testcases2:

Input:

39

Output:

12

Num=int(input(“Enter a number:”))

sumofdigits=0

While Num>0:

         Remainder=Num%10       #here % modolus operator                                                   gives decimal part 12%10=2

         sumofdigits=sumofdigits+Remainder

         Num=Num//10  #floor division gives integer part 12//10=1

Print(sumofdigits)

I think you are understanding python language ,so similarily you have to do more programs on python .

To understand string ,Tuple,Dictionary in details  so click on below links.

 String manipulation |Operation on string

 

 Tuple Manipulation

 

So finally To solve python Problems just read below points:

·     First things to know about keyword in python

Keywords are predefined word and they always write in small alphabets.

·     Then know about datatypes i.e string ,list ,tuple and dictionary .

·     Now you have to know how to take input .

·     Then you have to know how to test the test conditions.

·     How to run the loop.

·     Then understand and analyse the program and convert into suitable form.

 

 

Q.How to test the condition?

To test condition understand by example:

N=3

A=2

N>A or A>N  it is testing the condition.

 

A=3

N=1

if A>N:

         print(A “ is bigger number”)

else:

         print(N,”is bigger number”)

Here we are testing the two numbers using if -else structure  this is called testing.

 

So finally you have learned something from  given information.


No comments:

Powered by Blogger.