Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #16  
Old October 18th, 2012, 03:04 AM
emo.vs.elmo emo.vs.elmo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 44 emo.vs.elmo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 46 m 55 sec
Reputation Power: 1
LOL...I wish making it work was all i needed...hehe, i would have been done long ago,

my teachers mark everything including the quality of docstring...also, they want the summarized codes most of the time which they refer to as 'pythonic', and the closest thing i found on string was isalpha...

Reply With Quote
  #17  
Old October 18th, 2012, 05:15 PM
emo.vs.elmo emo.vs.elmo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 44 emo.vs.elmo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 46 m 55 sec
Reputation Power: 1
Okay, so i made the code... Can someone check what is wrong with it??

Code:
def is_match (puzzle,view):
    '''(str,str)->bool

    returns true iff puzzle and view match in the place
    where the letters are hidden

    >>>is_match ('apples','^pp^^^')
    True
    >>>is_match ('apples-bananas','^^^^^^^^^^^^^')
    False
    >>>is_match ('apples-i', '^^^^^^-^')
    True
    >>>is_match ('apples-i', '^^^^^^^^')
    False
    >>>is_match ('apples','^pp^a^')
    False
    
    '''
    a = 0
    if len(view) == len(puzzle):
        for i in range(len(puzzle)):
            if (puzzle[i] != view[i] and view[i] != HIDDEN):
                return False
    else:
        return False
    return True

Reply With Quote
  #18  
Old October 18th, 2012, 09:04 PM
b49P23TIvg's Avatar
b49P23TIvg b49P23TIvg is offline
Contributing User
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Aug 2011
Posts: 3,389 b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 3 Days 14 h 22 m 25 sec
Reputation Power: 383
Quote:
Originally Posted by wikipedia
Code:
Binary operations

Truth table for all binary logical operators
Here is a truth table giving definitions of all 16 of the possible truth functions of 2 binary variables (P,Q are thus boolean variables):
P	Q		 0 	 1 	 2 	 3 	 4 	 5 	 6 	 7 		 8 	 9 	10	11	12	13	14	15
T	T		F	F	F	F	F	F	F	F		T	T	T	T	T	T	T	T
T	F		F	F	F	F	T	T	T	T		F	F	F	F	T	T	T	T
F	T		F	F	T	T	F	F	T	T		F	F	T	T	F	F	T	T
F	F		F	T	F	T	F	T	F	T		F	T	F	T	F	T	F	T
where T = true and F = false.
Key:
Operation name
0	Opq	xand	false	Contradiction
1	Xpq	NOR	↓	Logical NOR
2	Mpq	Xq		Converse nonimplication
3	Fpq	Np	¬p	Negation
4	Lpq	Xp	↛	Material nonimplication
5	Gpq	Nq	¬q	Negation
6	Jpq	XOR	⊕	Exclusive disjunction
7	Dpq	NAND	↑	Logical NAND
8	Kpq	AND	∧	Logical conjunction
9	Epq	XNOR	If and only if	Logical biconditional
10	Hpq	q		Projection function
11	Cpq	XNp	if/then	Material implication
12	Ipq	p		Projection function
13	Bpq	XNq	then/if	Converse implication
14	Apq	OR	∨	Logical disjunction
15	Vpq	xnand	true	Tautology

Also consider "not".
__________________
[code]Code tags[/code] are essential for python code!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > PLEASE HELP (Matching two strings in python)

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap