Python Forum

Full Version: Program to print: Last Name, ID, Mobile Number, All
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello guys, I would appreciate if anybody could help me start this homework (im not asking for someone to solve it just to keep in mind)


A variable “personal_details” is given, declared by the details of a group of some persons.
The data of each person separated by the symbol ':'
while the persons are separated by the symbol ';'
 
personal_details = "Andrew Ratcliffe:111111:07777777777;Michael Burton :22222222: 07888888888;"
 
So I need to develop a program that will ask the first name of the person and then to print what you asked for or to print all the details of each person.
 
In case if the name of the person is not exist then the program should display the necessary message (i.e There is no such person registered)
 
Examples:
 
·        First example (hint: with bold is the data entry):
Give the name of the person you are looking for: Andrew


Select Data 1) Surame 2) Nr. ID 3) Nr. Mobile 4) All: 1

Andrew
Ratcliffe
 
 
·        Second example:
 
Give the name of the person you are looking for: Andrew
 
Select Data 1) Surname 2) Nr. ID 3) Nr. Mobile 4) All:  4
 
Andrew
Ratcliffe
111111
Ratcliffe
07777777777
 
·        Third Example:
Give the name of the person you are looking for: Andrew
 
There is no such person registered (Andrew)
Quote:So I need to develop a program that will ask the first name of the person and then to print what you asked for or to print all the details of each person.
  • Input name (or list) of person(s)
  • data_list = break input on ';'
  • for item in data_list:
  •      search “personal_details” for item
  •      print results
Larz60+ so this is actualy the code?
(Feb-24-2017, 08:09 PM)panick1992 Wrote: [ -> ]Larz60+ so this is actualy the code?
Definitely not. You can see that yourself if you tried running it :)
Lazar60+ Can I send you a pm please? I have more questions if you have the time to help me
We don't want to help people over PMs. Post some code (minimal, runnable) and ask a specific question to increase the chance of a high quality answer. See https://python-forum.io/misc.php?action=help for more info
Actually I do not know how to do it.

This is what I have done until now:

def personal_details():
return "Andrew Ratcliffe:111111:07777777777;Michael Burton :22222222: 07888888888;"

personal_details()
print (input('Enter the name: '))

print ('\n')

print (input( Select Data 1) Surame 2) Nr. ID 3) Nr. Mobile 4) All: '))

return "Andrew Ratcliffe:111111:07777777777;Michael Burton :22222222: 07888888888;"
You need to post code in code tags and with the proper indentation.
Is there any chance you could write some of the code and give me some guidance to write the rest of it>? I know i shouldn;t been asking this but I am desperate to solve this exercise
If you're really desperate, spend some time writing a proper question for your post and we'll become very helpful very quickly :)
Really though, this forum is about education and education is effortful, so some struggle is expected. We do also have a tutorials section.
Pages: 1 2