[Tutor] FW: query
abhijeet560 at yahoo.in
abhijeet560 at yahoo.in
Wed Jun 24 14:58:53 CEST 2015
Hey guys can anybody tell me what's wrong with this code: The code is below?Actually the point is that when we put "34h4" type of value it's an valueerror but here no handling is been performed by the python ???
while 1: number=int(input("Enter the number which u want to check for odd and even :")) try : if number%2==0: print("The number",number ," is Even") else: print("The number ",number ," is Odd") except ValueError: print("Invalid Input")
On Tuesday, 23 June 2015 11:32 PM, Alan Gauld <alan.gauld at btinternet.com> wrote:
On 23/06/15 18:13, Gupta, Manaswini Kat wrote:
> I need to fetch the records of count(*)>3 can you please tell me the logic in python
Sorry, but that's not very clear.
What do you mean?
It looks like a bit of SQL so, are you asking how to execute
that SQL from within Python? If so on what database?
Or are you trying to convert SQL logic into pure Python code?
If so that depends on how you are storing your records.
Are they in a list, a dictionary, a flat file?
Also count(*)>3 is a boolean expression so it will
return True or False and no records.
What do you mean by fetching the records?
Which records?
You probably need to show us an example of your data and
the results you want. Maybe show us the full SQL query
you are trying to execute or emulate.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
_______________________________________________
Tutor maillist - Tutor at python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list