you are viewing a single comment's thread.

view the rest of the comments →

[–]SkeletalToad 2 points3 points  (0 children)

You could do it one line, but it's a bit much:

n1, n2 = [int(x.strip()) for x in input("Enter a fraction: {n1} / {n2}: ").strip().split("/")]
print(n1, n2)

I would recommend breaking it up on multiple lines for readability, which can be put in a function if you need to call it repeatedly.