Skip to main content

Basic Structure of Python program


BASIC STRUCTURE OF A PYTHON PROGRAM

#addition of two number
a = 10
b = 20
c = a + b
print(c)
print(“Addition=“,c)
#check greater number between two
if a>b:
 print(“The value of a is greater”)
else:
 print(“The value of b is greater”)
Output:-
30
Addition=30
The value of b is greater

Elements of the Program

Comment – The statement which is starting with # symbol is called comment line. This line is ignored by compiler.
Statement – A statement is an instruction that the python interpreter can execute.
Expression – Expression are the statement which is used for calculation in programming language. E.g. c = a + b is an expression where the addition of a and b is stored in c. Expressions are formed with operators and operands.
Block or Suite – A block or suite are a group of statements in a program like control flow statement and looping statement.
Function – The print() or input() function in python are used to send output to the console window and receive input from the console window.


Comments

Popular posts from this blog

Q & A Chapter 1 | Internet Basics | Class 10 CBSE | Computer Application

 Q & A of Chapter 1 Internet Basics A. Tick the correct options – 1. (b) TCP/IP 2. (a) Internet Service Provider 3. (a) URL 4. (b) HTTP 5. (a) Bridge 6. (a) home page 7. (d) All of these 8. (b) Domain Naming System 9. (b) Rules 10. (d) ARPANET B. Very Short Answer Type Questions – 1. In the URL http://www.myfirm.co.in/about.html , what do the following components depict? (a) http                                                 (b) in (a) Http represents a type of server and the protocol on the Internet (b) ‘in’ represents the domain extension of the website. 2. In the URL http://www.favmusic.com/contactus.html what does www.favmusic stand for? www.favmusic represents the domain name i.e. favmusic in www. 3. W...

Create Composite Key in SQL

What is a composite key? A composite key in SQL can be defined as  a combination of multiple columns , which are used to identify all the rows involved uniquely. Even though a single column can't identify any row uniquely, a combination of over one column can uniquely specify any record. How to create a composite key? EG: