Python Forum
Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
card 21 trick
#5
How do I fix this problem, please help I need it by next week I have been trying for at least 2 weeks.

(Aug-16-2017, 09:08 PM)nilamo Wrote:
(Aug-16-2017, 08:48 PM)SummoningZ Wrote: The error is "AttributeError: 'function' object has no attribute 'extend'"
Which is what I said :)

As for pasting code, stick it in [ python] tags, and either right click and "paste without formatting" or ctrl+shift+v to do the same.  The forum 100% allows indentation in code blocks:
def spam():
    return "eggs"

for _ in range(5):
    print(spam())


first = ("JS","4C","KC","3H","5H","AD","10H")
second = ("9H","7S","JD","6D","JC","2D","QC")
third = ("5C","JH","4S","QS","8D","9D","4H")

def packet(first,second,third):
  for i in range(0,21,3):
    first.insert(0, packet[i])
    second.insert(0, packet[i+1])
    third.insert(0, packet[i+2])

print("1: " + " ".join([str(card) for card in first]))
print("2: " + " ".join([str(card) for card in second]))
print("3: " + " ".join([str(card) for card in third]))

selection = int(input("> "))
if selection == 1:
  packet.extend(second)
  packet.extend(first)
  packet.extend(third)
elif selection == 2:
  packet.extend(first)
  packet.extend(second)
  packet.extend(third)
elif selection == 3:
  packet.extend(first)
  packet.extend(third)  
  packet.extend(second)

print("You're thinking of the %s" % packet[10])
Thats the code.


Messages In This Thread
card 21 trick - by SummoningZ - Aug-16-2017, 05:50 PM
RE: I need help with my coding - Python 3 - by SummoningZ - Aug-16-2017, 09:23 PM
RE: card 21 trick - by metulburr - Aug-22-2017, 04:54 PM
RE: card 21 trick - by SummoningZ - Aug-22-2017, 07:56 PM
RE: card 21 trick - by SummoningZ - Aug-24-2017, 10:30 AM
RE: card 21 trick - by metulburr - Aug-24-2017, 12:42 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Turtle Graphics Card Values in a List Muzz 0 2,377 Apr-11-2019, 12:55 PM
Last Post: Muzz
  card dealer school project kalle1234 5 12,197 Jan-05-2019, 09:21 PM
Last Post: ichabod801
  Playing Card Sorting ness828 4 87,268 Feb-05-2018, 09:01 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020