Professional Documents
Culture Documents
def decimal2Binary(dec):
binaryString = ""
dec = dec // 2
return binaryString
Result:
dec = dec//16
return hexaString
Result:
Translator
from translate import Translator
language_code = "nl"
translator = Translator(language_code)
translation = translator.translate("Hello my name is daniel")
print(translation)
Result:
Result:
E = mc
import math
def einstein( m, c):
E = m * c ** 2
return E
itsAllRelative = einstein(m, c)
print("The amount of energy is: ", itsAllRelative)
Result:
Guess the age
guess = 0
age = 16
while guess != age:
guess = int(input("How old am I?"))
if guess < age:
print("Too young!")
elif guess > age:
print("Too old!")
else:
guess == age
print("You are correct!!")
Result: