IX_Part B _Unit 5_Introduction to Python_Notes (1)
The document provides an introduction to Python, covering key concepts such as computer programs, algorithms, and flowcharts. It highlights the advantages of Python, its applications, comments, keywords, identifiers, data types, operators, conditional statements, and loops. Overall, it serves as a foundational guide for understanding Python programming.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
2 views
IX_Part B _Unit 5_Introduction to Python_Notes (1)
The document provides an introduction to Python, covering key concepts such as computer programs, algorithms, and flowcharts. It highlights the advantages of Python, its applications, comments, keywords, identifiers, data types, operators, conditional statements, and loops. Overall, it serves as a foundational guide for understanding Python programming.
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2
Part B
UNIT 5 : Introduction to Python
❖ What is a computer program?
➢ A computer program is a collection of instructions that perform a specific task when executed by a computer. ➢ An algorithm is a step by step method or procedure to solve a problem. ➢ A flowchart is the graphical/pictorial representation of an algorithm using symbols, shapes and arrows.
❖ What are the advantages of using Python?
➢ Most commonly used language for coding in AI ➢ Easy to use, Free and open source, Extensive support for libraries, Portable, User- friendly, More functionality with less coding, Compatibility, Scalable ➢ IDE - Integrated Development Environment.
❖ Mention some applications of Python.
➢ GUI, software development, Database access, Games and 3D Graphics, Web and internet development
❖ What are Python comments?
➢ Comments are the statements that are incorporated in the code to give a better understanding of code statements to the user. ➢ Single line comment - one can use # and then write anything after it ➢ Multi line comment - one can use “ “ “ ” ” ” or ‘ ‘ ‘ ’ ’ ’and then write anything in between the quotation marks.
❖ What are Python keywords?
➢ Keywords are reserved words in Python with a specific purpose in the code. ➢ Example - if, elif, else, for, while, break, continue, return, True, False, or, and, in, is, as, try
❖ What are identifiers?
➢ Identifiers are the names given to the entities like class, variables, functions. ➢ Variable is a named location that stores data in the memory. ➢ Constants are variables with fixed value in a program. ❖ What are the different data types in Python? ➢ Numeric : int - for integer numbers, float - for decimal numbers ➢ String - str - for sequence of characters (within single quotes or double quotes) ➢ Tuple - tuple - The tuple is a collection of Python objects which are ordered & unchangeable. It is represented by round brackets - ( ). ➢ List - list - The list is a collection of Python objects which are ordered and changeable. It is represented by square brackets - [ ]. ➢ Set - set - The set is a collection of Python objects that are unordered, changeable, & can’t have multiple occurrences of the same item. It is represented by curly brackets - { }. ➢ Dictionary - dict - for storing data as a key-value pair and is changeable. Eg: {Key : Value}
❖ What are the different types of operators in Python?
➢ Arithmetic operator - for arithmetic operations ■ + (Addition), - (Subtraction), * (Multiplication), / (Division), % (Modulus), ** (Exponent) ➢ Assignment operator - for assigning values to variables ■ =, +=, -=, *=, /= ➢ Comparison operator - to compare 2 values or variables ■ <, >, <=, >=, ==, != ➢ Logical operator - these are the boolean operators to check conditions ■ and, or, not
❖ What are conditional statements?
➢ Conditional statements: - used for providing conditions in the code ■ if - else statements, if - elif - else statements
❖ What are loops in Python?
➢ Loops in Python: - used for repeating a set of Python statements ■ for loops, while loops, do-while loops.