Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Beginner's Python help!!
#1
I am a beginner to python and struggling already! (WAH!)

I have a question on a practice worksheet which I cannot crack. In fact, I'm not getting anywhere close to a solution!
______________________________________________________________

A variable name stores the name of a person with the title (in capitals) as given in their credit card. Write a program which displays a greeting "Good day M'am!" or "Good day Sir!" depending upon whether MS or MR was used in the title. If no title was given in the input, your program should print an error message (Please specify the title in capitals in the input..)


name = 'MR SAM WOODBRIDGE'
The output of your program should be 'Good day Sir!'

name = 'MS AMY PARKER'
The output of your program should be 'Good day M'am!'

name = 'AMY PARKER'
The output of your program should be 'Please specify the title in capitals in the input.'


______________________________________________________________

So far I have figured that this will involve the use of lists, strings and the if/elif/else functions. However, I keep getting endless amounts of error messages.

I am able to get the if/elif/else function to work with other programs which are just using numerical values, but as soon as sentences are involved, I struggle. How do I implement these sentences and titles to the program properly?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python Help Dεlluzion 3 1,725 09-30-2019, 12:59 AM
Last Post: samsmith001
  Simple Python Python Compiler Canoris 21 8,239 06-01-2011, 06:30 PM
Last Post: Filefinder
  Python 2 vs 3? Jake 8 2,159 12-11-2010, 04:13 PM
Last Post: Bursihido
  Python help Kharnage 2 733 02-12-2010, 09:07 PM
Last Post: Kharnage
  "==" and "is" in Python Canoris 1 724 02-07-2010, 03:55 PM
Last Post: uber1337

Forum Jump:


Users browsing this thread: 1 Guest(s)