Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Write a python program to accept Name and email id of participants for a webinar. Store the details into a dictionary.
Accept the details as long as the user would want to add details. Name will be the key and email-id as value into the dictionary. Take care such that if user enters a name which already exists in the dictionary it should not replace the email id with the new one. (Hint : use setdefault).
Pretty print the details

What I have tried:

ive tried solving this code but couldnt get it
Posted
Updated 12-Dec-20 3:56am

We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
 
Share this answer
 
Comments
rafg 12-Dec-20 21:03pm    
I could do this much of the code. Could you please guide me after this and help me finish it?

d={} #empty dict
while True: #infinite loop
tn=input("Enter name of particapant:")
w=input("Enter email id of participant:")
d[tn]=[w]
ch=input("Press Y or y to add another participant's info ")
if ch.upper()!='Y': #if ch!='Y' or ch!='y':
break
print(d)
Even for a beginner this is a fairly simple assignment. See 5. Data Structures — Python 3.7.9 documentation[^] for details of how to create and manage a Dictionary in Python.
 
Share this answer
 
Comments
rafg 12-Dec-20 21:02pm    
i could do this much of the code. Could you please guide me after this and help me finish it?

d={} #empty dict
while True: #infinite loop
tn=input("Enter name of particapant:")
w=input("Enter email id of participant:")
d[tn]=[w]
ch=input("Press Y or y to add another participant's info ")
if ch.upper()!='Y': #if ch!='Y' or ch!='y':
break
print(d)
Richard MacCutchan 13-Dec-20 3:10am    
What is the problem with that code? One thing I would suggest is to use meaningful names for your variables: namedict, username, email etc. rather than d, tn, w. It makes your code more readable and looks more professional.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900