What is scope resolution in python Language
A scope is a block of code where an object in Python remains relevant.Each and every object of python functions within its respective scope.As Namespaces uniquely identify all the objects inside a program but these namespaces also have a scope defined for them where you could use their objects without any prefix. It defines the accessibility and the lifetime of a variable.
Let’s have a look on scope created as the time of code execution:
- A local scope refers to the local objects included in the current function.
- A global scope refers to the objects that are available throughout execution of the code.
- A module-level scope refers to the global objects that are associated with the current module in the program.
- An outermost scope refers to all the available built-in names callable in the program.
Explain Inheritance in Python with an example?
As Python follows an object-oriented programming paradigm, classes in Python have the ability to inherit the properties of another class. This process is known as inheritance. Inheritance provides the code reusability feature . The class that is being inherited is called a superclass or the parent class, and the class that inherits the superclass is called a derived or child class.
What are python namespaces in python language
A Python namespace ensures that object names in a program are unique and can be used without any conflict. Python implements these namespaces as dictionaries with ‘name as key’ mapped to its respective ‘object as value’.
Let’s explore some examples of namespaces:
- Local Namespace consists of local names inside a function. It is temporarily created for a function call and gets cleared once the function returns.
- Global Namespace consists of names from various imported modules/packages that are being used in the ongoing project. It is created once the package is imported into the script and survives till the execution of the script.
- Built-in Namespace consists of built-in functions of core Python and dedicated built-in names for various types of exceptions.
What are Python Modules in python language
Files containing Python codes are referred to as python modulesThis code can either be classes,functions or variables and saves the programmer time by providing the predefined functionalities when needed.It is a file with .py extension containing an executable code.
Commonly used built modules are listed below:
- os
- sys
- data time
- math
- random
- JSON
explain how is memory managed in python?
- Memory in Python is managed by Python private heap space. All Python objects and data structures are located in a private heap. This private heap is taken care of by Python Interpreter itself, and a programmer doesn’t have access to this private heap.
- Python memory manager takes care of the allocation of Python private heap space.
- Memory for Python private heap space is made available by Python’s in-built garbage collector, which recycles and frees up all the unused memory.
what is pep8 in python language
PEP in Python stands for Python Enhancement Proposal.It is a set of rules that specify how to write and design Python code for maximum readability.
python is an interpreted language explain its interpretation
An interpreted language is any programming language which executes its statements line by line.Programs written in Python run directly from the source code, with no intermediary compilation step.
reference book for class xii CBSE term 1 computer science with python , only questions for practice .
Hello,
I hope you are doing fine, For CBSE 12th std board exam I prefer
- Sumita Arora's
- Together with Python
- Python CBSE book is really good!
It depends, check out these books. I think these are enough for class 12 student.
I hope you find this information helpful. I wish you all the best for your future.
Good Luck
Which programming languages should I learn in computer science with python?(As I started learning python from class 11)
Hello student,
My first and foremost suggestion to you is that start learning C language. It is first programming language to be in existence and the base of almost all the programming languages. Thus, learning and practicing this language will help to build your foundation quite clearly and help you to get a clear idea on all the important and difficult concepts of pointers, etc. After this you can learn C++ which is an upgraded version of C which also supports Object Oriented Programming along with Procedure Oriented Programming. This language is also important in perspective of Competitive Programming. Followed by that, try learning Java which is also again an Object Oriented Programming which has very vast application in the industry.
I hope this helps, All the Best!
Im weak in maths but good in computer science(python) in 12th standard. If I dont take maths in my college will it be hard for me to learn computer science or I can manage without taking maths in college?
Hello Rajatava,
Hope you are doing fine.
It's good to know that you have a grip on some computer language. Generally it won't affect your studies if you don't take maths as your subject because I did the same thing. But for general knowledge you cannot skip maths in some or the other semester you'll surely have maths as your elective subject.
And if you're planning for MCA than maths and statistics are one of the subjects necessarily required in your educational qualification.
So no matter what, maths will be one of the subjects in any of your semester.
Hope this helps you.
Best wishes for future.