Category Archives: Python

Open Browser using Python and without webdriver

import webbrowser webbrowser.open(‘https://www.google.com/’) Advertisements

Posted in Python, Uncategorized | Leave a comment

Print Square root of Array using numpy

import numpy as np arr=np.array([5,10,15]) print(np.sqrt(arr))

Posted in Python, Uncategorized | Leave a comment

Using Dictionary Python

”’ Created on Aug 11, 2017 @author: asharda ”’ legs={“human”:2,”cats”:4} for leg in legs: num=legs[leg] print(‘A %s has %d legs’ %(leg,num))

Posted in Python | Leave a comment

Probability Python

from random import choice destinations=[“Agra”,”Mumbai”,”New York”,”San Francisco”] print(choice(destinations))

Posted in Python, Uncategorized | Leave a comment

Basic Operations using Numpy

import numpy as np a=np.array([1,2,3]) print(a.shape) print(a.dtype) b=np.zeros((2,2)) print(b) c=np.ones((1,1)) print(c) d=np.eye(2) print(d) e=np.random.random((3,3,3)) print(e)

Posted in Python, Uncategorized | Leave a comment

Print Numbers between 5 and 50 in intervals of 2

import numpy as np print np.arange(5,50,2)

Posted in Python, Uncategorized | Leave a comment

In in Python

”’ Created on Jul 9, 2017 @author: asharda ”’ miles=11 milestone=[1,2,3,4,5,6,7,8,9,10] if miles in milestone: print(“Miles is there in milestone”) else: print(“Miles is not there in milestone”)

Posted in Python, Uncategorized | Leave a comment