Open in app

Sign in

Write

Sign in

Dineshbaburam
Dineshbaburam

1 Follower

Home

About

Mar 16, 2022

Instance method, Class method, and Static method

Instance method: Instance methods were called by an object which we created for the class. The instance object variable can be a modifier. Use “self” as the first parameter in the instance method. The “self” parameter refers to the current object. class Student: # initialization method…

Class

2 min read

Class

2 min read


Mar 16, 2022

Class and object in python

Class A class is a blueprint from which specific objects are created. Classes allow us to logically group our data and function to reuse and way to build upon if we need to be. Object Objects are instances of the class. The class allows grouping the data (Name, age, and salary). …

Class

2 min read

Class and object in python
Class and object in python
Class

2 min read


Mar 15, 2022

Enumerate in python

Enumerate in python Enumerate add an iterable counter and return enumerate object. Enumerate objects can be directly used in for loop or convert into the list of tuples using the list() method. some_string = "python" some_dict = {} print("Convert it into list") print(list(enumerate(some_string))) for i, some_dict[i] in enumerate(some_string): pass print("Dict") print(some_dict) The output Convert it into list [(0, 'p'), (1, 'y'), (2, 't'), (3, 'h'), (4, 'o'), (5, 'n')]

Python

1 min read

Python

1 min read


Mar 11, 2022

Junos PyEZ Table View for “show system process extensive”

“show system process extensive” is the CLI command in Junos which shows the running process in the device and its CPU and memory usages of each process. root> show system processes extensive last pid: 26688; load averages: 0.81, 0.95, 0.87 up 1+09:50:29 07:16:56 448 threads: 10 running, 397 sleeping, 41…

Jncia Junos

2 min read

Jncia Junos

2 min read


Feb 27, 2021

LeetCode: Palindrome Number

Given an integer x, return true if x is palindrome integer. An integer is a palindrome when it reads the same backward as forward. For example, 121 is palindrome while 123 is not. Example 1: Input: x = 121 Output: true Example 2: Input: x = -121 Output: false Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome. Program class Solution: def isPalindrome(self, x: int) -> bool: if x > 0: a = int(str(x)[::-1]) if x <= 0: a = int(str(x*-1)[::-1]) if a == x: return True else: return False

Palindrome

1 min read

Palindrome

1 min read


Feb 27, 2021

Leetcode: Reverse Integer

Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-231, 231 - 1], then return 0. Assume the environment does not allow you to store 64-bit integers (signed or unsigned). Example 1: Input: x = 123 Output: 321 Example 2: Input: x = -123 Output: -321 Program: class Solution(object): def reverse(self, x): flag = 0 list1 =[] if x < 0: flag = 1 list1[:0]= str(abs(x)) result = int("".join(list1[::-1])) if flag == 1: result = result * -1 if result > 2**31 - 1 or result <= -2**31: return 0 else: return(result)

Python

1 min read

Python

1 min read


Feb 27, 2021

Unique pointer in C++

Facts of unique pointer The unique pointer doesn’t share its memory. It can’t be copied to another unique by using an assignment operator. The ownership can be moved from one to another. “unique ptr” wants to limit the ownership of the object. Program #include <iostream> #include <memory> using namespace std; class Demo { public: Demo() { printf("Constructor called\n"); } void fun() { printf("Function calling\n"); } ~Demo() { printf("Destructor called\n"); } };

C Programming

1 min read

C Programming

1 min read


Feb 26, 2021

Void pointer

In c++, we can’t assign the address of a variable of one data type to a pointer of another data type. In such a case, use a void pointer or generic pointer. Facts: malloc() and calloc() returns void * type and allow this function to be used to allocate memory of any data type. void pointers are used to implement a generic function in c. void pointer can’t be dereferenced. int main() { int a = 10; void *ptr = &a; printf("%d", *ptr); }

C Programming

1 min read

C Programming

1 min read


Feb 26, 2021

Leetcode: Two Sum

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order. Example 1: Input: nums = [2,7,11,15], target = 9 Output: [0,1] Output: Because nums[0] + nums[1] == 9, we return [0, 1]. Example 2:

Leetcode

1 min read

Leetcode

1 min read


Dec 2, 2020

How to build docker container using ansible

What is Docker? The leading container platform that allows you to wrap your app, all of its dependencies, and library into a small executable bundle that can be run anywhere. What is Ansible? Ansible is an open-source DevOps tool that can help the business in configuration management, deployment, provisioning, etc…

Ansible Playbook

2 min read

Ansible Playbook

2 min read

Dineshbaburam

Dineshbaburam

1 Follower

Network Automation Engineer

Help

Status

About

Careers

Blog

Privacy

Terms

Text to speech

Teams