Python | Convert case of elements in a list of strings

[ad_1] Given a list of strings, write a Python program to convert all string from lowercase/uppercase to uppercase/lowercase. Input : [‘GeEk’, ‘FOR’, ‘gEEKS’] Output: [‘geeks’, ‘for’, ‘geeks’] Input : [‘fun’, ‘Foo’, ‘BaR’] Output: [‘FUN’, ‘FOO’, ‘BAR’]  Method #1 : Convert Uppercase to Lowercase using map function    out = map(lambda x:x.lower(), [‘GeEk’, ‘FOR’, ‘gEEKS’]) … Read more

Amazon Interview Experience SDE Off Campus

[ad_1] Written Round: (1 hour) Given a linked list and K, print the last K nodes in reverse order.example: 1->2->3->4->5->6, K = 3 output: 6 5 4 Find out whether the given tree is BST or not. Rotate Given matrix by 90 clockwise. Technical Round: (1 hour) Given an array, for every element in the array, you … Read more

Method resolution order in Python Inheritance

[ad_1] Method Resolution Order :Method Resolution Order(MRO) it denotes the way a programming language resolves a method or attribute. Python supports classes inheriting from other classes. The class being inherited is called the Parent or Superclass, while the class that inherits is called the Child or Subclass. In python, method resolution order defines the order … Read more

host command in Linux with examples

[ad_1] host command in Linux system is used for DNS (Domain Name System) lookup operations. In simple words, this command is used to find the IP address of a particular domain name or if you want to find out the domain name of a particular IP address the host command becomes handy. You can also … Read more

Minimum removals in a number to be divisible by 10 power raised to K

[ad_1] Given two positive integers N and K. Find the minimum number of digits that can be removed from the number N such that after removals the number is divisible by 10K or print -1 if it is impossible. Examples: Input : N = 10904025, K = 2 Output : 3 Explanation : We … Read more

Finding Mean, Median, Mode in Python without libraries

[ad_1] In this article, we will learn how to calculate Mean, Median and Mode with Python without any using external libraries. Mean : The mean is the average of all numbers and is sometimes called the arithmetic mean. This code calculates Mean or Average of a list containing numbers: n_num = [1, 2, 3, 4, … Read more