Code - MappingSystem/Tutorial-Buka-Toko GitHub Wiki
myfunction(x, y):
return x + y
else:
print("Hello!")
if mark >= 50
print("You passed!")
if flag:
print("Flag is set!")
esle:
print("Bye!")
# with checks
n = None
while n is None:
s = input("Please enter an integer: ")
if s.lstrip('-').isdigit():
n = int(s)
else:
print("%s is not an integer." % s)
def main():
Do this
Do that
try:
dividend = int(input("Please enter the dividend: "))
divisor = int(input("Please enter the divisor: "))
print("%d / %d = %f" % (dividend, divisor, dividend/divisor))
except ValueError:
print("The divisor and dividend have to be numbers!")
except ZeroDivisionError:
print("The dividend may not be zero!")
def main():
Do this
Do that
try:
dividend = int(input("Please enter the dividend: "))
except ValueError:
print("The dividend has to be a number!")
try:
divisor = int(input("Please enter the divisor: "))
except ValueError:
print("The divisor has to be a number!")
try:
print("%d / %d = %f" % (dividend, divisor, dividend/divisor))
except ZeroDivisionError:
print("The dividend may not be zero!")
def main():
Do this
Do that
try:
file = open('input-file', 'open mode')
except:
# In case of any unhandled error, throw it away
raise
def main():
Do this
Do that
try:
age = int(input("Please enter your age: "))
except ValueError:
print("Hey, that wasn't a number!")
else:
print("I see that you are %d years old." % age)
finally:
print("It was really nice talking to you. Goodbye!")
def main():
Do this
Do that
try:
age = int(input("Please enter your age: "))
if age < 0:
raise ValueError("%d is not a valid age. Age must be positive or zero.")
except ValueError as err:
print("You entered incorrect age input: %s" % err)
else:
print("I see that you are %d years old." % age)
import logging
# log messages to a file, ignoring anything less severe than ERROR
logging.basicConfig(filename='myprogram.log', level=logging.ERROR)
# these messages should appear in our file
logging.error("The washing machine is leaking!")
logging.critical("The house is on fire!")
# but these ones won't
logging.warning("We're almost out of milk.")
logging.info("It's sunny today.")
logging.debug("I had eggs for breakfast.")
https://travis-ci.org/mirumee/saleor
- Fitur - Error tracking
- Create dan Install Project
$ pip install --upgrade sentry-sdk==0.7.14
import sentry_sdk
sentry_sdk.init("https://[email protected]/XXXXXX")
https://codecov.io/gh/mirumee/saleor
https://codeclimate.com/github/mirumee/saleor/pull/2626