Thanx Terry it worked, I was thinking if input_string could be
searched from given_string and replaced in the input_string but your
one is smarter.
And Peter, thanx for trying to teach conventions. But if I write
explicit comments, and carry on using my own variables( I can use
anything as they
On Jul 18, 6:43 pm, John Machin [EMAIL PROTECTED] wrote:
On Jul 18, 11:42 pm, ptn [EMAIL PROTECTED] wrote:
[snip]
Remember C, where i, j,
k are indices, p, q, r are pointers, s, t are strings and x, y, z are
integers.
Only by convention (even-KR-v1 C required explicit declarations
Dear Group,
I am trying the following code line:
def try2(n):
a1=raw_input(PRINT A STRING:)
a2=a1.split()
a3=God Godess Heaven Sky
for x in a2:
a4=a3.find(x)
if a4-1:
a5=a3[a4]
print a5
On Fri, 18 Jul 2008 01:31:59 -0700, SUBHABRATA wrote:
def try2(n):
a1=raw_input(PRINT A STRING:)
a2=a1.split()
a3=God Godess Heaven Sky
for x in a2:
a4=a3.find(x)
if a4-1:
a5=a3[a4]
print a5
SUBHABRATA wrote:
I am trying the following code line:
def try2(n):
user_line = raw_input(PRINT A STRING:)
user_words = user_line.split()
my_line = God Godess Heaven Sky
for word in user_words:
pos = my_line.find(word)
if pos - 1:
first_char =
Sorry if I didn't say that.
The input is a string Petrol Helium Heaven Sky
Now, in a3 it is God Goddess Heaven Sky is there,
it is matching Heaven and Sky but not Petrol and Helium as they are
not in a3.
Now, as per the code it is giving me an output S of Sky and
Helium
But I was looking for an
Thanx Peter,
I would change my variables next time I would post. And obviously,
thanx for your solution. I am reviewing it, I was also trying out some
solutions.
Best Regards,
Subhabrata.
Peter Otten wrote:
SUBHABRATA wrote:
I am trying the following code line:
def try2(n):
user_line =
Hi Peter,
In your code s would print first_char(of the last word)+
+missing_word(the last word) I was looking all.
Best Regards,
Subhabrata.
SUBHABRATA wrote:
Sorry if I didn't say that.
The input is a string Petrol Helium Heaven Sky
Now, in a3 it is God Goddess Heaven Sky is there,
it is
SUBHABRATA wrote:
Thanx Peter,
I would change my variables next time I would post.
No, you should use meaningful variable names when you write your code no
matter whether you plan to post it or not.
And obviously,
thanx for your solution. I am reviewing it, I was also trying out some
Hi Peter,
Peter Otten wrote:
SUBHABRATA wrote:
Thanx Peter,
I would change my variables next time I would post.
No, you should use meaningful variable names when you write your code no
matter whether you plan to post it or not.
Good You are teaching me something good in life. Thanx.
to split and
iterate and join with s.
Best Regards,
Subhabrata.
--
Date: Fri, 18 Jul 2008 12:11:00 +0200
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: Question on Joining of list
In that case, the line 's=a5+ +a6' should be inside the for loop
On Jul 18, 5:40 am, SUBHABRATA [EMAIL PROTECTED] wrote:
Hi Peter,Peter Otten wrote:
SUBHABRATA wrote:
Thanx Peter,
I would change my variables next time I would post.
No, you should use meaningful variable names when you write your code no
matter whether you plan to post it or not.
SUBHABRATA wrote:
Sorry if I didn't say that.
The input is a string Petrol Helium Heaven Sky
Now, in a3 it is God Goddess Heaven Sky is there,
...I was looking for an output of H S Petrol Helium
Meaningful names, splitting the target string, and using 'in' makes the
code much easier.
On Jul 18, 11:42 pm, ptn [EMAIL PROTECTED] wrote:
[snip]
Remember C, where i, j,
k are indices, p, q, r are pointers, s, t are strings and x, y, z are
integers.
Only by convention (even-KR-v1 C required explicit declarations
almost everywhere), and x etc being used for integers is news to
me
14 matches
Mail list logo