mitkrieg/CS112-Spring2012 — comment on commit ec74a73b39e97d93012fc99068e6b2b1dd8e36a5
File:  line 0
By alecgoebel:

# Homework 3

> Your ascii, table, and fractions programs were supposed to be in separate files. On to the grading.

| **Part** | **Points** |
|-----------|------------|
| base | 1 |
| advanced | 0.5 |
| if and while | 0.25 |
| **Total** | 1.5 |

## PrissyBot

Your prissybot program itself is fine overall. The output is clean, you properly used string formatting. Your code is easy to read as well (thank you for the spaces.)

## Conversion table
The spacing seems a bit odd (things look like you meant them to be centered but they aren't). That said, the table is perfectly done and you used string formatting correctly.

## Fractions
To be fair, this assignment for this was oddly worded. The point of this section was to convert from an improper to a proper fraction, not reduction as I mistakenly called it. That said, the example I gave was `6/4 = 1 2/4`.

Reduction is more complicated and used `%` so we'll count it. Brute forcing every divisor from 255 to 1 is a reasonable decision if you know what the input range. However, in this case you don't know the input range so it fails for 1268 / 1585. If you just use the smaller of the two numbers and the upper bound, brute forcing works fine.

```python
numerator=int(raw_input("Numerator: "))
denominator=int(raw_input("Denominator: "))
found = False
factor = min(numerator, denominator)
while not found and factor > 1:
factor -=1
if (numerator % factor) == 0 and (denominator % factor) == 0:
found = True
print "The fraction %d/%d reduces to %d/%d" % (numerator, denominator, numerator/factor, denominator/factor)
```

## Ascii art
Assignment was: `draw some kind of ascii art based on user input`. I was looking for something that was generated through programming, not ascii art off the internet.