Page 1 of 1

Python help? (Solved)

Posted: Tue Aug 04, 2015 12:09 pm
by Octavian
I am attempting to write a program to solve for the lowest common denominator in two or more fractions. I am in the very beginning of writing this program and I am running into some trouble with my Argument variable. I am a beginner at programming in python but I am by no means a beginner in the terminology. I programmed in Micro Engineering Labs (Micro code studio) on chips before I started on Python. :oops:

I just need a point in the right direction. Thanks in advanced for your help. :D

Note: I am doing this program to learn Python and be able to teach myself math. I am not in College or school so I am not using this for home work rather I am using it to check my work after I practice a couple math problems on paper.

Code: Select all

 
#Import argument variable.
from sys import argv

#name variables to use; Numerator of fraction and Denominator of fraction
num_N = argv
num_D = argv
prompt = ">"

#Ask for fraction 
print "What is the Numerator?"
num_N = raw_input(prompt)
print "What is the Denominator?"
num_D = raw_input(prompt)

#Print fraction before solving for Lowest common denominator
print 'Your fraction is...' $% num_N
print 'Over' $% num_D
Terminal output example

Code: Select all

File "FractLCD.py", line 12
    print 'Your fraction is...' $% num_N
                                ^
SyntaxError: invalid syntax

Re: Python help? (Solved)

Posted: Tue Aug 04, 2015 12:17 pm
by Octavian
Sorry I just figured out that I had to write print for the variable on a separate line. Sorry for bothering you guys :oops: