Yes you could go with
.upper()
.lower()
and the best one to suit your need is:
.capitalize()
print('WiZaRd'.lower())
print('WiZaRd'.upper())
print('WiZaRd'.captialize())
Output:
wizard
WIZARD
Wizard
Hmm where am I supposed to put it? in the input line? input.capitalise?
def c():
found = False
jobs = input("Enter the job title: ")
#right here!
jobs = jobs.capitalize()
for b in employees:
if jobs == b[2]:
## what with the len(i) in these if-statement
if len(b)==5:
print('%-30s' % (b[4]+ ','+' '+b[3]))
found = True
if len(b)==6:
print('%-30s' % (b[5]+','+' '+b[3]+' '+b[4]))
found = True
if len(b)==7:
print('%-30s' % (b[6]+','+' '+b[3]+' '+b[4]+' '+b[5]))
found = True
if found == False:
print("There is no such job")
To put all the chances on your side, you should write:
if jobs == b[2].capitalize():
Just in case that the input file contains job names written in lower cases or upper cases.
Yay thanks! Fully working exercise now. Satisfying.
I see. What could go wrong with jobs = jobs.capitalize()?
Oooh got it.
In fact, you need both:
First jobs = jobs.capitalize()
Second, when you do the comparison, make sure that you compare with something that is capitalized as well, hence if jobs == b[2].capitalize():
You guys willing to help with second part of the assignment?
Yes, it a good standard practice. But the data he provided didn't have that problem so it wasn't necessary to do so.
Yes, I on board! Kind of annoyed that we did not manage to get the previous one in on time...
I made a new thread for the second part. I think that's best. It's called word search grid.