Python Assignment-Introduction to Python

Python Basic Assignment covers the Basics of Python Programming Language. This Assignment or Python Question Banks is taken from the internet.  This Python Assignment or Question Bank covers very basic of Python that includes an introduction to the editor, Tokens, Data types, Keywords and how to use python Print command.

At the End of this Python Assignment for student-Sample answers are also written.

  1. Define the term Computational
  2. Write any four features of
  3. Write any four application areas of
  4. What is a text editor? Name any two text
  5. What is an interpreter?
  6. What is IDLE? What are the two modes of working with IDLE?
  7. What is print() in Python?
  8. Name the keyword arguments of print()
  9. What is a data type? What are the fundamental data types in Python?
  10. Identify the data types of the following data objects:

(i) 7 (ii) ‘7’  (iii) “7”  (iv) 7.0  (v) ”’7”’  (vi) -0.7 (vii) -29  (viii) -15.38

(ix) “29 acres” (x) “. & #”

  1. Find outputs of the following commands in Python:

(i) print(“Hello”)  (ii) print(2+3,34-67) (iii) print(“2+3″,2+3)

(iv) print (‘2+3′,2+3,sep=”=”)   (v) print(2**3,3**2,sep=’*’)

(vi) print(2**3, 2**-3, -2**3, (-2)**3, sep=” and “)

  1. Find error(s), if any, in the following statements:
    • print(“three’) (ii) Print(3)  (iii) print(44’+’56)   (iv) print(3,2 sep=’: ‘)

(v) print “wisdom”   (vi) print[’33+44′] (vii) PRINT(“15 August 1947”)

  1. What are unary operators and binary operators? Give two examples of
  2. What is the operator precedence of arithmetic operators in Python?
  3. Evaluate the following expressions manually:

(i) (2 + 3) ** 3 – 6 / 2            (ii)   (2 + 3) * 5//4+(4 + 6)/ 2                (iii) 12 + (3 * 4 – 6) / 3

(iv) 12 + (3 * *4 – 6)// 2        (v)   12 * 3 % 5 + 2 * 6//4                   (vi)    12 % 5 *3 +(2*6)//4

  1. Evaluate the above expressions by using IDLE as a calculator and verify the results that you got
  2. Write Python command to display your name on
  3. Write Python command to display your name, class, and section, separated by “-“.

 

ANSWERS

  1. Computational thinking is the thought processes involved in formulating a problem and expressing its solution(s) in such a way that a computer—human or machine—can effectively carry
  2. Four features of Python:
    1. Python is free to use, even for commercial products, because of its OSI-approved open source
    2. Python is a cross-platform language. It runs on Windows, Linux/Unix, Mac OS X, and has been ported to the Java and .NET virtual
    3. Python’s syntax is easier to learn than most of the other programming
    4. Python can be used to create desktop applications and web
  3. Four application areas of Python:
    1. Web and Internet development
    2. Database access
    3. Desktop GUIs
    4. Data Sciences
  4. A text editor is an application software to create and manage text files. Two text editors are Notepad and Notepad++.
  5. An interpreter is a software which converts a high-level language program into machine language and gets it executed line by
  6. IDLE is the default IDE of It stands for Integrated Development and Learning Environment. Two modes of working with IDLE are: Interactive mode and Script mode.
  7. print() is a function to display the specified content on
  8. The keyword arguments of print() are: end, file, flish,
  9. Data type refers to the type of value of a data object. Fundamental data types in Python are: bool, complex, float, int,
  10. (i) int (ii) str    (iii) str    (iv) float  (v) str  (vi)  float  (vii) int  (viii) float  (ix) str   (x) str 11. (i) Hello (ii) 5 -33   (iii) 2+3 5   (iv) 2+3=5   (v) 8*9   (vi) 8 and 0.125 and -8 and -8
  • The quotation marks of string are not properly The corresponding correct statements are:

print(“three) and  print(three’)

  • P of Print should be in lower The corresponding correct statement is: print(3)
  • Multiple arguments of print should be separated by The corresponding correct statements are: print(44,’+’,56) and print(44+56)
  • There should be comma between 2 and sep. The correct statement is: print(3,2, sep=’: ‘)
  • The argument of print should be within parentheses. The corresponding correct statement is:

print(“wisdom”)

  • The argument of print should be within parentheses. The corresponding correct statement is:

print(’33+44′)

  • PRINT should be in lowercase. The corresponding correct statement is:

print(“15 August 1947”)

  1. An operator which takes one operand is called a unary operator. Examples of unary operators are unary + and unary -. An operator which takes two operands is called a binary operator. Examples of binary operators are * and /.
  2. Operator precedence of arithmetic operators in Python is as follows:
  • (**) > (unary +, unary -) > (*, /, //, %) > (binary +, binary -) (i) 122.0 (ii) 11.0 (iii) 14.0 (iv) 49 (v) 4 (vi) 9
  1. print(“your name”)
  2. print(‘name,class,’sec’, sep=’-‘)
Download File :