473,785 Members | 3,352 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

python not returning true

I have a function, generally described as so:

def function(args):
if condition:
if condition2:
function(args+1 )
elif condition3:
print "text"
return True
else:
return False

which is used in:

if function(args):
print "ok"
so here basically "text" will print out when condition3 is true but it
will not print out "ok" when condition3 is true. When it's true it
should print out borth "text" and "ok"

Feb 14 '07
13 2257
Michael Bentley <rm****@gmail.c omwrites:
# Something just doesn't seem right in those
# "Every kiss begins with 'K'" commercials.
>'Every Kiss'.startswit h('K')
False
>>kisses = ["kiss", "kiss", "kiss", "kiss", "kiss"]
kisses == [kiss for kiss in kisses
... if kiss.startswith ("k")]
True

Happy St. Valentine's Day, everyone.

--
\ "Experience is that marvelous thing that enables you to |
`\ recognize a mistake when you make it again." -- Franklin P. |
_o__) Jones |
Ben Finney

Feb 14 '07 #11
On 2007-02-14, Terry Reedy <tj*****@udel.e duwrote:
>| Wit has nothing to do with it. The fact that you are a Python noob is
| also irrelevant. Your problem statement was unintelligible, as is your
| response. What does "pwn" mean?

I believe that it is a misspelling of 'own' used by pvp (person versus
person, as opposed to person versus monster) gamers to demonstrate their
in-ness. But perhaps agent-s can enlightenment us further.
Mis-spelling things is witty now? Wow. I've been witty all
these years and didn't even know it...

--
Grant Edwards grante Yow! I'm EXCITED!! I want
at a FLANK STEAK WEEK-END!! I
visi.com think I'm JULIA CHILD!!
Feb 14 '07 #12

"John Machin" <sj******@lexic on.netwrote in message
news:11******** *************@l 53g2000cwa.goog legroups.com...
|| | On Feb 14, 5:45 pm, "agent-s" <shanek...@gmai l.comwrote:
| | btw Steven you are so witty I hope to one day pwn noobs on
newsgroups
| | too.
| >
| Sorry, but you are 'pwning' yourself here ;-)
|
| And the referent of "you" would be .....?

agent-s, as I though was obvious.

Feb 15 '07 #13
Wow. I didn't realize you guys took this so seriously.

Feb 23 '07 #14

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

Similar topics

5
4489
by: Eric | last post by:
The following example will explain what i want to do: >>> def func(): print "true" >>> rules=(func,) >>> for rule in rules: rule I expect the final function to print true, but instead i have <function func at 0x00DC6EB0>
10
3692
by: Andrew Dalke | last post by:
Is there an author index for the new version of the Python cookbook? As a contributor I got my comp version delivered today and my ego wanted some gratification. I couldn't find my entries. Andrew dalke@dalkescientific.com
22
1954
by: James H. | last post by:
Greetings! I'm new to Python and am struggling a little with "and" and "or" logic in Python. Since Python always ends up returning a value and this is a little different from C, the language I understand best (i.e. C returns non-zero as true, and zero as false), is there anything I should be aware of given Python's different approach? Namely any pitfalls or neat tricks that make the Python approach cool or save my butt. Thank you!
77
3953
by: Ben Finney | last post by:
Howdy all, PEP 354: Enumerations in Python has been accepted as a draft PEP. The current version can be viewed online: <URL:http://www.python.org/peps/pep-0354.html> Here is the reStructuredText source as it is today. Please discuss it here so I can see what issues people may have.
5
6777
by: Michael Sperlle | last post by:
Is it possible? Bestcrypt can supposedly be set up on linux, but it seems to need changes to the kernel before it can be installed, and I have no intention of going through whatever hell that would cause. If I could create a large file that could be encrypted, and maybe add files to it by appending them and putting in some kind of delimiter between files, maybe a homemade version of truecrypt could be constructed. Any idea what it...
0
9643
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
9480
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
10147
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...
1
10085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8968
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...
0
6737
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.