Day 041 - Project 41 : Website Bookmark manager

If you have any questions, comments or issues with this project please post them here!

Hi, is there any chance I could get some guidance on how to use only one input to get the name, url, desc and rating and split() and print the dictionary please?

Hi @RamonaG welcome to the community and thanks for your question!

I’ve created a short program that asks the user to enter their full name and then uses .split() to extract the components into firstname and surname variables.

You can view the code here
https://replit.com/@IanAtReplit/gettingInfoFromSingleInput

The video below shows how it works

2 Likes

Hi there! How can I use the input function to assign the user’s input as values directly to the empty keywords in the dictionary? Or will that be part of the later 100 days ?
Thanks so much for your help! I love David’s course :blush:

1 Like
myDictionary = {"name" :None,"URL":None,"descr":None,"rating":None}

values=input("WHats the name ,url,describ and rating for website?").split()
for key,value in myDictionary.items():
  if key=="name":
    myDictionary[key]=values[0]
  elif key=="URL":
    myDictionary[key]=values[1]
  elif key=="descr":
    myDictionary[key]=values[2]
  elif key=="rating":
    myDictionary[key]=values[3]

for name,values in myDictionary.items():
  print(f"{name}:{values}")

That is how i did it but im sure there must be a simpler way! Could anyone show us please :slight_smile: Thank you

2 Likes

you can further shorten this:

content = input('website_name, url, descr, rating?').split(sep=",")

myDictionary = {'website_name':None, 'url':None, 'descr':None, 'rating':None }

i= 0
for x,y in myDictionary.items():
  i+=0 #instead of manually adding 1,2,3 this function can help
  myDictionary[x] = content[i]

print(myDictionary)