python logarithm code example
Example 1: log2 in python
math.log2(x)
Example 2: create log in python
logging.basicConfig(filename="logfilename.log", level=logging.INFO)
logging.info('your text goes here')
logging.error('your text goes here')
logging.debug('your text goes here')
Example 3: tangent python 3
import math
import random
variable = random.randint(6, 9)
print(atan(variable))
Example 4: is login a class in python
class User:
def __init__(self,username,password,basket):
self.username=username
self.password=password
self.basket=basket
Example 5: is login a class in python
def Login(self):
while True:
username = raw_input('\nPlease log in by providing your user credentials \nUser Name :')
if (username == users[0]['username'] or username == users[1]['username']):
password = raw_input('Password : ')
if (password == users[0]['password'] or password == users[1]['password']):
print('Successfully logged in!')
print (
'Welcome,' + username + '! Please choose of the following options by entering the corresponding menu number.')
global LoggedUserName
LoggedUserName = username;
return True;
break;
else:
print('Your password is not correct. Please try again!')
else:
print ('Your username is not correct. Please try again!')