Finance[US] Career Guide Free Tutorials Go to Your University Placement Preparation 
0 like 0 dislike
257 views
in Python Programming by Goeduhub's Expert (9.3k points)

1 Answer

0 like 0 dislike
by Goeduhub's Expert (9.3k points)
selected by
 
Best answer

Q10.  Explain how can you make a Python Script executable on UNIX?

Ans.  To make a Python Script executable on UNIX, you need to do two things

  • Script file's mode must be executable and

  • the first line must begin with # ( #!/usr/local/bin/python)

Q11.  Explain how can you access a module written in Python from C?

Ans.  You can access a module written in Python from C by following method,

Module = =PyImport_ImportModule("<modulename>");

Q12.   Mention the use of // operator in Python?

Ans.   It is a Floor Division operator, which is used for dividing two operands with the result as quotient showing only digits before the decimal point. For instance, 

10//5 = 2 and 10.0//5.0 = 2.0.

Q13.  What does this mean: *args, **kwargs? And why would we use it?

AnsWe use *args when we aren’t sure how many arguments are going to be passed to a function, or if we want to pass a stored list or tuple of arguments . to a function. **kwargs is used when we don’t know how many keyword arguments will be passed to a function, or it can be used to pass the values .   of a dictionary as keyword arguments. The identifiers args and kwargs are a convention, you could also use *bob and **billy but that would not be, wise.

Q14.  What is the Difference between Python 3 and Python 2 ?

Ans.  

Python2

Python3

It is more stable and transparent version of python programming language.

It is future of Python designed to address the design flawn in the previous versions.

The print syntax is treated as a statement rather than a function that requires text to be wrapped in parenthesis. 

The print is explicitly treated as a function and replaced by the print() function in Python 3 which requires an extra pair of parenthesis.

ASCII string type is used by default to store strings.

Unicode is the implicit string type by default.

It simply returns an integer to the nearest whole number when dividing two integers.

It makes integer division more intuitive by using true division for integers and floats.

xrange function reconstructs the sequence every time.

xrange is replaced by range() function in Python 3.

Q15.  What is Enumerate() Function in Python?

Ans.   The Python enumerate() function adds a counter to an iterable object. enumerate() function can accept sequential indexes starting from zero.

Learn & Improve In-Demand Data Skills Online in this Summer With  These High Quality Courses[Recommended by GOEDUHUB]:-

Best Data Science Online Courses[Lists] on:-

Claim your 10 Days FREE Trial for Pluralsight.

Best Data Science Courses on Datacamp
Best Data Science Courses on Coursera
Best Data Science Courses on Udemy
Best Data Science Courses on Pluralsight
Best Data Science Courses & Microdegrees on Udacity
Best Artificial Intelligence[AI] Courses on Coursera
Best Machine Learning[ML] Courses on Coursera
Best Python Programming Courses on Coursera
Best Artificial Intelligence[AI] Courses on Udemy
Best Python Programming Courses on Udemy

 Important Lists:

Important Lists, Exams & Cutoffs Exams after Graduation PSUs

 Goeduhub:

About Us | Contact Us || Terms & Conditions | Privacy Policy ||  Youtube Channel || Telegram Channel © goeduhub.com Social::   |  | 

 

Free Online Directory

...