Skip to main content

Posts

Showing posts with the label Programming

Q & A Chapter 2 | Python | Class 10 CBSE | Computer Application

Python Q & A Chapter 2 A. Tick the correct option – 1. (c) Boolean 2. (d) Level 3. (a) Built-in 4. (c) both (a) and (b) 5. (b) control B. Very Short Answer Type Questions – 1. What is control variable? The variable which controls the flow of execution of the program is called control variable. These control variables are used in Decision Making statements or Looping statements. 2. What do you mean by Flow of Control? A computer always executes a program sequentially. It starts execution from the first statement and ends at the last statement. This order of execution of statements is called Flow of Control. 3. How many types of loops are there in Python? There are two types of loops in python, For loop and While loop. 4. In how many ways you can call range() in Python? The range() function can be called by three ways. The range() function can be used with three arguments depending on the need of the programmer. 5. Write the syntax of For loop. for ...

Q & A Chapter 1 | Python | Class 10 CBSE | Computer Application

Solutions of Computer Science with Python Class 10 A. Multiple Choice Questions(Tick the correct options) -  1. (d) 2. (c) 3. (b) 4. (a) 5. (b) 6. (b) 7. (c) 8. (a) 9. (a) 10. (a) B. Very short answer type questions - To exit from python editor press ctrl + z from keyboard or exit(). Operators are the symbols which perform the operation on some values. There are two types of operators Unary and Binary Operator. Python is available for free anybody can download and make programs in python. Also you can add or update modules or functions in python library. Tokens are smallest unit of a python program. Python breaks each lines into a sequence of meaningful component. Punctuators are symbols that are used in programming languages to organize sentence structures. The most common punctuators are ' " # C. Short Answers - Escape Sequence is a character that contains a special meaning. There are various types of escape sequence some of them are '\n...

Control Flow Statement in Python

Control Flow Statement in Python A computer always executes a program sequentially. It starts execution from the first statement and ends at the last statement. This order of execution of statement(s) is called Flow of Control . But if you want some statements to print after fulfilling some condition then this can be achieved by using the control flow statement . The control flow statement or control statements are used to control the flow of execution of the program. There are three different types of control flow statements in python: Sequential Decision making or selection Looping or iterative Sequential – Sequential execution of statements is the default behaviour of the program, in which it executes one line after another. Decision Making or Selection – Decision making statement is also called selection statement. Here, the execution of the statements depend upon the condition. Once the condition is fulfilled then the control of the flow will move accordingly....

Escape Sequence

What are Escape Sequence characters? Give example. Escape Sequence is a character that contains a special meaning. Escape Sequence Description \n New line \\ Backslash \’ Single quotation \” Double quotation \a Bell \b Backspace \r Carriage return \t Horizontal tab \v Vertical tab

Data types in Python

Data types in Python A data type represents the type of data stored into a variable or memory. There are five main data types : Numeric String List Tuple Dictionary Note – Variables are the address in the memory where the values are stored. We can treat variable like a container where you can put or store something. Numeric Data Type The numeric data types are used to represent numbers. There are three sub data types : int f loat complex Int data type The int data type represents an integer number. An integer number are a number without any decimal point or fraction part. For example 200, -100, 67, 100000, etc. Integer uses 4 bytes to store a value. It can range from -2147483648 to 2147483647. Float data type The float data type represents floating point numbers. A floating point number is a number that contains a decimal point. Like 3.14, 34.45, -45.678, etc. Float uses 8 bytes to store a value. It can range from 2.3E-308 to 1.7E+308. ...

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 pyt...

Operators in Python

Operators Operators are the symbols which perform the operation on some values. These values are known as operands. For example if we write a + b, the operator + acts on the two operand a and b, this is called binary operator. If an operator acts on a single operand then it is called unary operator. Example:- -a                            Unary Minus operator +a                           Unary Plus Operator a + b                      Binary Operator Operators are divided into eight parts: Unary Operator Arithmetic Operator Assignment Operator Relational Operator Logical Operator Identity Operator Membership Op...