5 must-know Python topics for data science in hindi | Python important topics for data science | what is imp in Python .

Python के 5 सबसे ज्यादा imp topics ,data science के लिए ।


1)  function :- 

          Function एक building block है python मैं । ये शुन्य या अधिक तर्क लेते है और मान(value) वापस करते है । हम def keyword का उपयोग करके एक function बनाते है ।

Example :- 



def my_function():
	print("hello readers")
2) Positional and keywords arguments:-

    (1) positional argument's केवल एक नाम द्वारा घोषित किए जाते है ।

   

def info(name, age):
    print(f"Hi, my name is {name}. I am  {age * 365.25} days old.")
# This does what is expected
info("Alice", 23.0)
# This doesn't
info(23.0, "Alice")
(2) keywords arguments नाम और एक डिफॉल्ट मान (default value ) द्वारा घोषित किए जाते है । 

Example :-


def team(name, project):
    print(name, "is working on an", project)

team(project = "Edpresso", name = 'FemCode')
3) *args and kwargs :- 

     Arguments को संभालने के लिए args or kwargs इसे आसान और क्लीनर बनाते है ।

★ args अनुमति देता है function को की वो किसी भी संख्या के positional arguments को ले सके 

Example :- 


def myFun(*argv):  

    for arg in argv:  

        print (arg) 

    

myFun('Hello', 'Welcome', 'to', 'beprogrammer')
★ kwargs अनुमति देता है function को की वो किसी भी संख्या के keywords argument को ले सके 

Example :- 


# Python program to illustrate   
# *kwargs for variable number of keyword arguments

  

def myFun(**kwargs):  

    for key, value in kwargs.items(): 

        print ("%s == %s" %(key, value)) 

  
# Driver code 

myFun(first ='hello', mid ='be', last='programmer') 
4) classes :- 

      Python मैं सभी एक object of a type है जैसे integers , lists, dictionaries , functions ओर भी बोहोत कुछ । हम type of object को define करते है classes को use करके ।

Classes मैं निम्नलिखित जानकारी है : 

Data attributes :- एक class का उदाहरण तैयार करने के लिए क्या आवश्यक है ।

तरीको (यानी procedural attributes ) : हम एक class के उदाहरणों के साथ कैसे बातचीत करते है ।

Example : 

class MyClass:
  x = 5
5) Lists : 

        Lists Python मैं एक अंतर्निहित data structure है । square brackets मैं data points के collection के रूप मे यह प्रदर्षित किया जाता है । किसी डेटा प्रकार या विभिन्न डेटा प्रकारों के मिश्रण को  store करने के लिए lists का प्रयोग किया जा सकता है । 

       Lists परिवर्ती (mutable ) है जो इनके सामान्य इस्तेमाल के कारणों मैं एक है । 

      इस प्रकार हम items को हटा सकते है और जोड़ सकते है  lists की वस्तुओं को update करना भी सम्भव है ।

Example :- 

# Negative indexing in lists
my_list = ['p','r','o','b','e']

# last item
print(my_list[-1])

# fifth last item
print(my_list[-5])

Post a Comment

0 Comments