Python 345

0202. Beginner Series #1 School Paperwork

Your classmates asked you to copy some paperwork for them. You know that there are 'n' classmates and the paperwork has 'm' pages. Your task is to calculate how many blank pages do you need. If n < 0 or m < 0 return 0. Example: n= 5, m=5: 25 n=-5, m=5: 0 Waiting for translations and Feedback! Thanks! Solution: def only_int(func): def wrapper(n, m): if n < 0 or m < 0: return 0 return func(n, m) r..

0128. Gauß needs help! (Sums of a lot of numbers).

Due to another of his misbehaved, the primary school's teacher of the young Gauß, Herr J.G. Büttner, to keep the bored and unruly young schoolboy Karl Friedrich Gauss busy for a good long time, while he teaching arithmetic to his mates, assigned him the problem of adding up all the whole numbers from 1 through a given number n. Your task is to help the young Carl Friedrich to solve this problem ..