Python help? (Solved)

Forum rules
Before you post please read how to get help
Post Reply
Octavian
Level 1
Level 1
Posts: 30
Joined: Mon Jul 21, 2014 11:02 am

Python help? (Solved)

Post by Octavian » Tue Aug 04, 2015 12:09 pm

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
Real men wear pink but a true man will be who he is even when the world thinks differently.
Due to my Job I am only able to get on Thursday through Saturday. On occasion I will be on other days.

Octavian
Level 1
Level 1
Posts: 30
Joined: Mon Jul 21, 2014 11:02 am

Re: Python help? (Solved)

Post by Octavian » Tue Aug 04, 2015 12:17 pm

Sorry I just figured out that I had to write print for the variable on a separate line. Sorry for bothering you guys :oops:
Real men wear pink but a true man will be who he is even when the world thinks differently.
Due to my Job I am only able to get on Thursday through Saturday. On occasion I will be on other days.

Post Reply

Return to “Scripts & Bash”