Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

attributes in python

class Monkey(object):
  def __init__(self, name): # This will done automatically when cmd in 7th line will be executed
    self.name = name # This is an attribute.
  def speak(self): # This is a method
    print("Hello! I am " + self.name)
    
IronMan = Monkey('TonyStark')
IronMan.speak() # This will use the function 'speak' defind in class 'Monkey'
# Created By ....
Comment

PREVIOUS NEXT
Code Example
Python :: python list with several same values 
Python :: panda lambda function returns dataframe 
Python :: model checkpoint 
Python :: python upload file to s3 
Python :: how to iterate row wise using 2d integer array in python 
Python :: python index for all matches 
Python :: python regeression line 
Python :: insert blank row in data frame 
Python :: python responses 
Python :: add vertical line in plot python 
Python :: Data Structure tree in python 
Python :: nan vs nat pandas 
Python :: add values from 2 columns to one pandas 
Python :: ++ in python 
Python :: loops in python 
Python :: time a function python 
Python :: Create A Template In Django 
Python :: aws lambda logging with python logging library 
Python :: how to find the last occurrence of a character in a string in python 
Python :: UserWarning: X does not have valid feature names, but LinearRegression was fitted with feature names 
Python :: django edit object foreign key id 
Python :: insert in python 
Python :: python code variable declaration 
Python :: e in python 
Python :: for schleife python 
Python :: how to replace a character of a string 
Python :: string comparison in python 
Python :: python file 
Python :: how to create list of objects in python 
Python :: python declare 2d list 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =