Wednesday, 10 April 2019

Python Interview Questions And Answers Part 1



What is Python? 


  • Python is a high-level, interpreted, interactive and object-oriented scripting language. 
  • Python is designed to be highly readable. 
  • It uses English keywords frequently where as other languages use punctuation, and it has fewer syntactical constructions than other languages.
What are the supported data types in Python?

          Python has five standard data types −
  • Numbers
  • String
  • List
  • Tuple
  • Dictionary

What is the difference between list and tuples?

      
LISTTUPLES
Lists are mutable i.e they can be edited.Tuples are immutable (tuples are lists which can’t be edited).
Lists are slower than tuples.Tuples are faster than list.
Syntax: list_1 = [10, ‘Chelsea’, 20]Syntax: tup_1 = (10, ‘Chelsea’ , 20)

How is memory managed in Python?

      Python memory is managed by Python private heap space. All Python objects and data structures are located in a private heap.


What is dictionary in Python?

The built-in datatypes in Python is called dictionary. It defines one-to-one relationship between keys and values. Dictionaries contain pair of keys and their corresponding values. 

Example :
dict={‘Country’:’India’,’Capital’:’Delhi’,’PM’:’Modi’}
print dict[Country]





No comments:

Post a Comment

Git

1 git add ↳ It lets you add changes from the working directory into the staging area 2 git commit ↳ It lets you save a snapshot of currently...