473,804 Members | 3,311 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question on Joining of list

Dear Group,
I am trying the following code line:
def try2(n):
a1=raw_input("P RINT 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
elif a4<0:
a6=x
print "It is not found"
print a6
else:
print "Error"
s=a5+" "+a6
print s

Here, if I put a string like:
Petrol Helium Heaven Sky
In s it is giving me S Helium
But I am looking for an output of a5 and a6 concatenating all its
values not the last ones. Can you suggest me any help? Am I missing
any minor point?
Best Regards,
Subhabrata.
Jul 18 '08
13 1010
On Jul 18, 11:42 pm, ptn <tn.pa...@gmail .comwrote:
[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-K&R-v1 C required explicit declarations
almost everywhere), and x etc being used for integers is news to
me ... perhaps you were thinking of m and n.

The only language I remember that had implicit typing was FORTRAN (GOD
is real, but JESUS is an integer).
Jul 18 '08 #11
ptn
On Jul 18, 6:43*pm, John Machin <sjmac...@lexic on.netwrote:
On Jul 18, 11:42 pm, ptn <tn.pa...@gmail .comwrote:
[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-K&R-v1 C required explicit declarations
almost everywhere), and x etc being used for integers is news to
me ... perhaps you were thinking of m and n.

The only language I remember that had implicit typing was FORTRAN (GOD
is real, but JESUS is an integer).
Yes, I meant by convention.

x is the first name that comes to mind when declaring an unimportant
int. Perhaps it's just me.
Jul 19 '08 #12
On Jul 19, 6:34*am, Dennis Lee Bieber <wlfr...@ix.net com.comwrote:
On Fri, 18 Jul 2008 16:43:35 -0700 (PDT), John Machin
<sjmac...@lexic on.netdeclaimed the following in comp.lang.pytho n:
The only language I remember that had implicit typing was FORTRAN (GOD
is real, but JESUS is an integer).

Hadn't seen that one before -- maybe because I learned FORTRAN IV at a
college in the middle of west Michigan; I think half the population was
one step away from turning Amish <G>

I learned it by the word: Indian -- implicit integers began at I, and
ended with N.
You could've just used the first 2 letters of 'integer'! :-)
Jul 20 '08 #13
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 are variables:-) ) according to my own ease isn't
that good?
Best Regards,
Subhabrata.

MRAB wrote:
On Jul 19, 6:34�am, Dennis Lee Bieber <wlfr...@ix.net com.comwrote:
On Fri, 18 Jul 2008 16:43:35 -0700 (PDT), John Machin
<sjmac...@lexic on.netdeclaimed the following in comp.lang.pytho n:
The only language I remember that had implicit typing was FORTRAN (GOD
is real, but JESUS is an integer).
Hadn't seen that one before -- maybe because I learned FORTRAN IV at a
college in the middle of west Michigan; I think half the population was
one step away from turning Amish <G>

I learned it by the word: Indian -- implicit integers began at I, and
ended with N.
You could've just used the first 2 letters of 'integer'! :-)
Jul 21 '08 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1954
by: Carlos Ribeiro | last post by:
As a side track of my latest investigations, I began to rely heavily on generators for some stuff where I would previsouly use a more conventional approach. Whenever I need to process a list, I'm tending towards the use of generators. One good example is if I want to print a report, or to work over a list with complex processing for each item. In both cases, a simple list comprehension can't be used. The conventional approach involves...
3
583
by: Alex | last post by:
Hi, I need to form a query where i can add some columns based on the result. Table A ColA, ColB ---------- 1 A 2 B
10
2629
by: Paulo Jan | last post by:
Hi all: Let's say I'm designing a database (Postgres 7.3) with a list of all email accounts in a certain server: CREATE TABLE emails ( clienteid INT4, direccion VARCHAR(512) PRIMARY KEY, login varchar(128) NOT NULL,
9
2003
by: Riley DeWiley | last post by:
I have a programming problem in OLEDB and C++ that seems to be pointing me toward using layered views and hierarchical rowsets. However, I am uncertain of the precise implementation and need guidance from someone experienced in those areas. The problem, in the abstract, is how to select a set of records in one table, each one of which has a relation to every one of a set of records in another table, the tables being joined in a...
11
2292
by: Madison Kelly | last post by:
Hi all, I am new to the list and I didn't want to seem rude at all so I wanted to ask if this was okay first. I have a program I have written in perl which uses a postgresSQL database as the backend. The program works but the performance is really bad. I have been reading as much as I can on optimizing performance but still it isn't very reasonable. At one point I had my program able to process 175,000 records in 16min 10sec on a...
2
1128
by: Howard | last post by:
I need to write a web page that outputs a table from database. ( i want to write my own code, don't want to use the built-in control) I came up with two ways of doing this (i use c# 2.0) 1. pesudo code sqlstringTable = "select category_name from table1" execute(sqlstringTable) while(read)
1
2893
by: lee | last post by:
Hi This is a dumb question as I know it's fairly easy but I cant seem to find an example after two hours of searching. In a stored procedure I'm trying to build up a string eg, (the following is in a loop) IF @xcount 0
25
4208
by: Nicholas Parsons | last post by:
Howdy Folks, I was just playing around in IDLE at the interactive prompt and typed in dir({}) for the fun of it. I was quite surprised to see a pop method defined there. I mean is that a misnomer or what? From the literature, pop is supposed to be an operation defined for a stack data structure. A stack is defined to be an "ordered" list data structure. Dictionaries in Python have no order but are sequences. Now, does anyone know...
1
1390
by: jehugaleahsa | last post by:
I have some code that looks like this: int customerIds = { 1, 2, 3, 4, 5, 6, 7, 8 }; List<Threadthreads = new List<Threads>(); foreach (int customerId in customerIds) { Thread thread = new Thread(delegate() { // do calculation with customerId });
13
1489
by: Thomas Troeger | last post by:
Hi, Sorry I've posted a similar question some weeks ago, but I got no answers. I want to embed a Python application on a device with limited resources, esp. storage limitations. Is there a way to reduce the Python interpreter to a set of modules that's urgently needed? Or is there a method to have gzipped modules that are unzipped on the fly into memory when they're accessed? That would be even better. Additionally, is there a Python...
0
9708
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9588
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10085
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7625
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3828
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.