1
I can’t seem to solve this exercise. I need the letter indicating the type of service (E,R or F) to be indicated in the same line as the other information, however, according to the letter inserted, the requested information is different, there I do not know how to do.
Exercise: Lavajet Management
Input: Each entry line starts with a letter ːE', ?R' or ?F', indicating the type of transaction to be conducted. If the transaction is of type E' (enter), the rest of the line will contain the first name of the client (without spaces), and what kind of service to be performed (great wax or wash). If the transaction is R' (withdraw), the rest of the row will contain only the first name of the customer having his car removed. Finally, the last line of the input will always be of the type F', indicating the closure car wash.
Output: For each transaction of the R' type, your program must print the last service that was performed on the car in question. In case there is no registered car under the requested name, print 'Unregistered User'.
Example:
Entree:
And Walter wax
R Heisenberg
R Walter
F
Exit:
Unregistered user
wax
My code:
dicionario = {}
c=0
while c==0:
letra = input()
if letra=="E" :
nome, serviço = input().split()
dicionario.update({nome:serviço})
elif letra== "R":
nome1=input()
if nome1 in dicionario.keys():
print(dicionario[nome1])
else:
print("Usuário não cadastrado!")
elif letra=="F":
c=c+1
Exactly that! Thank you!
– Jordana