Page 2 of 2 First 12
  • Jump to page:
    #16
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    44
    Rep Power
    3
    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...
  2. #17
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    44
    Rep Power
    3
    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
  4. #18
  5. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,995
    Rep Power
    481
    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 and Makefiles!
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo