Solution for Chapter 9: Python - Introduction

 A. Tick the Correct answer:-

    1. All python keywords contain __________ letters except true, False and None.

        a. lowercase.

    2. _______ are the special symbols that carry out arithmetic and logical computations.

        b. Operators

    3. The values operated by the operator are called _______.

        b. Operands

    4. ______ define the way to store the values in memory.

        b. Variables

B. Write 'T' for True and 'F' for False statements.

    1. Python is named after Monty Python's Flying Circus, a comedy program.

        True.

    2. Python is not a case-sensitive language.

        False.

    3. Python interpreter never ignores the written in comment.

         False.

    4. Single quotes ( ' ' )  and double quotes ( "  ") are used to represent strings in python.

        True.

    5. Initializing a variable means to assign a value to an identifier.

        True.

    6. Input() function always returns string value.

        True.

C. Fill in the blanks:-

    1. We can also press _____ key to run a program.

    Ans.: F5

    2. ______ are the reserved words in Python.

    Ans.: keywords.

    3. ______ are the data items which never change their value throughout program run.

    Ans.: Literals

    4. Python uses ______ to express the block structure of a program.

    Ans.: Space and Delimiter.

D. Define the following:

    1. Token:

      Ans.: A Token is a smallest element of a program that is meaningful to the interpreter. Tokens supported in Python include identifiers, delimiter, keywords, literals and operators among others.

    2. Operator:

    Ans.: Operators are the special symbols that carry out arithmetic and logical computations. The values operated by the operators are called Operands.

    3. Comments:

    Ans.: Comments are very important while writing a program in any language. They are used to explain Python Code and make it more readable.

E. Differentiate between the following:

Keywords

Literals

Keywords are the reserved words in Python and can't be used as constant, variable or any other identifier name. There are 33 keywords in python.

Such as, assert, input etc.

The data items that never change their value throughout the program that run are called Literals

 

Such as, String Literals, "hello", '12345' etc.

F. Answer in 1-2 sentences.

    1. Who developed Python and when?

    Ans.: Python was created by Guido van Rossum and was first released on February 20, 1991. It is named after 'Monty Python's Flying circus' a comedy television show.


Guido van Rossum

Note to read: Monty Python is an English landish (European Linguistic genre) comedy show, that though is considered as comedy show based on the region it may not be perceived by us that is may not properly be considered as Comedy based on our ritual, living culture and practices.

'Monty Python at a Cheese Shop show' a comedic satire shot at a shop of Northern England where Monty is asking Spanish and Danish Gouda cheese and the seller is keep saying Noooo!

A sample video of Monty Python show, telecasted on BBC UK, 45 years ago.

    2. What do you mean by Identifier?

    Ans.: A random name made out of letters, digits and or underscore (_) to identify a function name, a program name or a memory location is known as Identifier.

   For example, word 'apple' can be considered as identifier for any variable.

    3. What are variables?

    Ans.: Variables are used to store data in the memory. The data can be numbers, text or objects. The data is given a name, so that it can be re-called whenever it is needed.

    4. What do you understand by the line and indentation?

    Ans.: Line: A Python program is made up of one or more physical lines. Each physical line may end with a comment.

              Indentation: An Indentation is an empty space at the beginning of block of code. Python uses indentation to express the block structure of a program.

G. Answer brieflly?

    1. How many data types are used in Python? Explain in detail.

    Ans.: There are mainly three types of data types used in Python, they are as follows:

    a) Integer: Integers are whole numbers consisting of + or - signs without decimal point such as 1000, -88 etc.

    b) Float: Float data types represents floating point numbers which contain decimal point. For example, 0.5, -12.25, 256.25 etc.

    c) String: String is a sequence of characters used to store and represents text-based information. Single quotes ( ' ' ) and double quotes ( " " ) are used to represent string Python.

    2. Define input() and print() functions of Python?

    Ans.: 

    a) input() : Input function is used to get input from user. This function helps user to input the values and text for the operation. this function always returns string value.

    b) print() : Print function is used to print the value of given input value or string. It helps to show output on screen.

 H. Application based question is not required now, will be uploaded will be later.

Comments

Post a Comment

Popular posts from this blog