Assignment 1
Unit 1: Introduction and Syntax of Python Programming
Q1. Difference between Scripting Language and Programming Language
Programming language is used to build complete software and applications.
Examples include C, C++ and Java.
A scripting language is used to automate tasks and run inside another program.
Examples include Python, JavaScript and PHP.
Programming languages are often compiled while scripting languages are interpreted.
Assignment 1
Unit 1: Introduction and Syntax of Python Programming
Q2. Features of Python
Python is easy to learn and has simple syntax.
It is an interpreted language.
It is platform independent and runs on many operating systems.
Python supports object oriented programming.
It has a large standard library and is open source.
Assignment 1
Unit 1: Introduction and Syntax of Python Programming
Q3. Applications of Python
Python is used in web development.
It is widely used in data science and data analysis.
It is used in artificial intelligence and machine learning.
Python is useful for automation and scripting.
It is also used in game development and cyber security.
Assignment 1
Unit 1: Introduction and Syntax of Python Programming
Q4. Basic Structure of Python Program
A Python program usually starts with comments.
Then required modules can be imported.
Variables and functions are defined.
Finally the main program statements are written.
Example:
name = input('Enter name')
print('Hello', name)
Assignment 1
Unit 1: Introduction and Syntax of Python Programming
Q5. Keyword, Identifier and Variable
Keywords are reserved words in Python like if, else, while and for.
Identifiers are names given to variables, functions or classes.
A variable is used to store data in a program.
Example:
age = 20
name = 'Rahul'
Assignment 1
Unit 1: Introduction and Syntax of Python Programming
Q6. Data Types with Example
Python supports different data types.
int example: a = 10
float example: b = 3.14
string example: name = 'Python'
boolean example: flag = True
list example: numbers = [1,2,3]
Assignment 1
Unit 1: Introduction and Syntax of Python Programming
Q7. Input and Print Functions in Python
input() function is used to take input from the user.
print() function is used to display output on the screen.
Example:
name = input('Enter your name: ')
print('Hello', name)
Assignment 1
Unit 1: Introduction and Syntax of Python Programming
Q8. Type Casting with Example
Type casting means converting one data type into another.
int('25') converts string to integer.
float(10) converts integer to float.
str(100) converts number to string.
bool(1) converts number to boolean.