Python Forum
Program to print: Last Name, ID, Mobile Number, All
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Program to print: Last Name, ID, Mobile Number, All
#1
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)
Reply
#2
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
Reply
#3
Larz60+ so this is actualy the code?
Reply
#4
(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 :)
Reply
#5
Lazar60+ Can I send you a pm please? I have more questions if you have the time to help me
Reply
#6
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
Reply
#7
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;"
Reply
#8
You need to post code in code tags and with the proper indentation.
Reply
#9
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
Reply
#10
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Bug Program to check whether a number is palindrome or not PythonBoy 18 2,718 Sep-12-2023, 09:27 AM
Last Post: PythonBoy
  Python Program to Find the Factorial of a Number elisahill 2 1,442 Nov-21-2022, 02:25 PM
Last Post: DeaD_EyE
  Program that allows to accept only 10 integers but loops if an odd number was entered gachicardo 4 3,635 Feb-24-2022, 10:40 AM
Last Post: perfringo
  How can I print the number of unique elements in a list? AnOddGirl 5 3,297 Mar-24-2020, 05:47 AM
Last Post: AnOddGirl
  Print the Largest Odd Number Than999 5 4,214 Jul-24-2019, 11:35 AM
Last Post: jefsummers
  Program that, inside a loop, does multiple things. needs to print in a certain way reidmcleod 1 2,679 Feb-19-2019, 02:35 PM
Last Post: marienbad
  How to print a statement if a user's calculated number is between two floats Bruizeh 2 2,406 Feb-10-2019, 12:21 PM
Last Post: DeaD_EyE
  Program that displays the number with the greatest amount of factors ilusmd 3 2,826 Nov-01-2018, 08:28 PM
Last Post: ichabod801
  Print only number penoxcz 1 2,574 Nov-10-2017, 11:04 AM
Last Post: metulburr

Forum Jump:

User Panel Messages

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