Can someone Help me code python?

I’m doing the 100-day course here so would be Great getting some help Thnx a Ton!

Hey @Rocko,

I’d lobr to help you, could you send you code an explain the problem you are having!

1 Like

should I type in the code or share the link its the day 44 solution I couldn’t understand the part where David sir explained to check for duplicates he said while num in numbers then num = user-input

def createCard():
global bingo
numbers =
for i in range(8):
num = ran()
while num in numbers:
num = ran()
numbers.append(num)

edit
does this work if I do for num not in the list and then append else continue? won’t it solve the duplicate issue if not why ? please explain someone :sweat_smile:

def createCard():
	global bingo
	# a list to store the numbers generated
	numbers = []
	# repeat 8 times (generating 8 different numbers)
	for i in range(8):
		# set `num` to a random number
		num = ran()
		# while `num` is already in the list of `numbers`
		while num in numbers:
			# generate a new random number
			num = ran()
		# now we have a new number that isn't in `numbers`, so we append it to `numbers`
		numbers.append(num)
1 Like

thnx for the reply late still appriciated thnx a ton! and for the info tho it still gives duplicates I solved it by calling the subroutine after the while num in number I called the ran() subroutine directly! it solved the duplicates :smile:

hey, bro, can you fix my edit code here it got some weird thing going on whenever I try to edit the 2nd row it shows couldn’t find the item for a brief moment then proceeds to edit that line for when I can’t find the item but its somehow showing for the 2nd lines

#image is taken from google no copyright intented!
import os,time,random

print("\t""\033[34m""Wonder Bucket Lists!!""\033[0m")
time.sleep(1)
print()
print("\t""\033[33m""list your items on the go""\033[0m")
print()
print()
bucketList =[]
colourChoice= ["black","red","green","yellow","blue"]

def sasyColors(color): 
  if color=="black":  
    return("\033[30m")   
  elif color=="red":    
    return("\033[31m" )   
  elif color=="green":    
    return("\033[32m")   
  elif color=="yellow":
    return("\033[33m")   
  elif color=="blue":   
    return("\033[34m")
  else:   
    return("\033[0m")
    
def listedItems():
  print()
  print()
  view=input ("1: View all \n2: View by priority \n\n> ")
  if view=="1":
    print()
    for bucketItems in bucketList:
      for item in bucketItems:
        print(sasyColors(random.choice(colourChoice)),item,"\033[0m",end=" | ")
      print()
    time.sleep(1)
  elif view=="2":
    print()
    priority=input("What priority items you'd like to view\n> ")
    for bucketItems in bucketList:
      if priority in bucketItems:
        for item in bucketItems:
          print(sasyColors(random.choice(colourChoice)),item,"\033[0m",end=" | ")
      print()
    time.sleep(1)
    
while True:
  counter= 1
  print("\033[30mplease type the number next to their corresponding action to proceed \033[0m")
  print()
  listMenu= input("\033[32mMENU\033[0m\t\n1: Add an item to bucketlist \n2: Remove an item from it \n3: View items all or by priority \n4: Edit an Item from your bucket list \n5: Delete..  The bucket list and start a new one.\n6: would you Like to Exit the Bucket List maker ?\n\n~ ")
  
  if listMenu== "1": 
    print()
    itemName=input("What'll be on your today's bucket lists sir !\n\n>")
    itemDate=input ("For which date ?\n>")
    priority=input("priority rate ?!\n>")
    bucketItems=[itemName,itemDate,priority]
    if bucketItems in bucketList:
      print(f"{sasyColors('black')}{itemName} Item has already been added to the list{sasyColors('white')}")
      time.sleep(5)
      os.system("clear")
    else:  
      bucketList.append(bucketItems)
      counter+=0
      print()
      print("Item has been sucessfully added to the bucketlist")
      print()
      time.sleep(1)
      os.system("clear")
      
  elif listMenu=="2":
    print()
    removeItems=input("What'd you like to remove sir !\n\n> ")
    print()
    check= input ("Are you sure you want to remove the item ?(yes / No)\n: ").lower()
    print()
    if check== "yes":
      for bucketItems in bucketList:
        if removeItems in bucketItems:
          counter -=1
          bucketList.remove(bucketItems)
          print("Item has been sucessfully removed from wonderList!")
          time.sleep(1)
          os.system("clear")
    else:
      print()
      print(f"{itemName} is not listed inside your today's work menu ")
      
  elif listMenu== "3":
    listedItems()
    print()
    time.sleep(4)
    os.system("clear")
  
  elif listMenu=="4":
    print()
    editItems=input("Which item you'd like to edit sir ?\n\n>")
    for bucketItems in bucketList:
      if editItems in bucketItems:
        check=input("Are you sure you want to edit the item?(Yes / No) \n>").lower()
        if check=="yes":
          bucketList.remove(bucketItems)
          print()
          itemName=input("What'll be on your \033[34mNEW\033[0m item for today's bucket lists sir !\n\n>")
          itemDate=input ("For which date ?\n>")
          priority=input("priority rate ?!\n>")
          bucketItems=[itemName,itemDate,priority]
          if bucketItems in bucketList:
            print(f"{sasyColors('black')}{itemName} Item has already been added to the list{sasyColors('white')}")
            time.sleep(5)
            os.system("clear")
          else:  
            bucketList.append(bucketItems)
            print()
            print("Item has been sucessfully added to the bucketlist")
            print()
            time.sleep(1)
            os.system("clear")
        else:
          print()
          print("Beep boop going backwards in time...")
      else:
 
        print("couldn't find the item in wonderlist going backwards...")
        time.sleep(2)
      os.system("clear")
  elif listMenu== "5":
    print("Your Bucket List has been sucessfully deleted")
    bucketList= []
    time.sleep(1)
    os.system("clear")
    
  elif listMenu =="6":
    print("Wonder List will be waiting for you!")
    print("Goodday!")
    time.sleep(1)
    os.system("clear")
    break
    
  if counter == 8:
    closeOrContinue= input("Would you like to Exit or Continue to adding more on your daily lists?\n\n> ").lower()
    if closeOrContinue== "continue":
      continue 
    else:
      break

Ran the code and and played with it a little and I see nothing wrong with it

oh, sir no it has a lil big for a brief moment only It shows the line couldn’t find the item for a very short moment! before resuming the editing process wait sir let me add time to it and this bug if only for the 2nd 3rd rows there’s no bug for the first row somehow

added sir would you please check again thank you!

like I added [a,b,c], [d,e,f],[g,h, I] so when I go to edit “a” it edits correctly but when I type “d” or “g” it first says couldn’t find the item for a brief moment then proceeds with the editing process the edit works but the couldn’t find line is bombing it somehow

Made sure you do everything and I got no errors and everything worked as intended

Sir, I still couldn’t fix it may I ask you to take a look once more this time iv added a time pause to it too…
just try adding 2 lists [a,b,c] [d,e,f] and try editing d the bug is totally visible and killing my joy out of coding if you take a gander it’d be awesome if not then that’s alright too thnx ig.