Skip to content

Instantly share code, notes, and snippets.

View peroh215's full-sized avatar
🏫
Student

peroh peroh215

🏫
Student
View GitHub Profile
@peroh215
peroh215 / calculator.py
Created November 13, 2018 21:08
Shortest calculator possible in Python
#!/usr/bin/env python
try:
usr = input('Enter operation: ')
pu = int(eval(usr))
print(pu)
except NameError as ne:
print('You need to enter a mathematical operation')
@peroh215
peroh215 / even_number_checker.py
Created November 4, 2018 17:36
Program that checks if a number (inputted by the user) is even or odd
#!/usr/bin/env python
#Author: Blackman White
#Description: Program that checks if a number (inputted by the user) is even or odd
def check_even(num):
hnum = int(num / 2)
if hnum * 2 != num:
print("Number is odd")
else:
print("number is even")