0

Hello,
I'm working on a program that would print the prefixes of two user inputs if they matched. I'm thinking of this along the lines of if the value of the first character in a is = to the value of the first character in b, print the value. Next I would say that if the value of the first and second characters in a is the same as the first and second characters in b, print items. I didn't get that far before it collapsed. Anyway this is the code I have so far:

>>> first=raw_input("Please enter the first string")
Please enter the first string
>>> second=raw_data("Please enter the second string")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'raw_data' is not defined
>>> second=raw_input("please enter the second string")
please enter the second string
>>> a = first
File "<stdin>", line 1
a = first
^
IndentationError: unexpected indent
>>> a=first
>>> b=second
>>>
>>>
>>> if len(b) < len(a)
File "<stdin>", line 1
if len(b) < len(a)
^
SyntaxError: invalid syntax
>>> if len(b) < len(a):
... a=first
... a=second
... b=first
...
>>> if value 1 in a = value 1 in b
File "<stdin>", line 1
if value 1 in a = value 1 in b
^
SyntaxError: invalid syntax

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by pyTony
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.