0
Many inputs
Hi. I've few codes that I'd want to share here, but every need more than one input. For example building character needs name, strength, etc. Or guess number with more than one tryout after tip from game that guess was too big or too small. Is it possible to do it somehow?
3 Answers
+ 1
I tred to create a `collecter` for your data (building character):
# i hope you like the solution:
qualities = {
'name':'',
'gender':'',
'strength':0,
'character':0,
'quality':0,
'wisdom':0,
}
def get_the_data(the_dict):
result_dict = {}
if not isinstance(the_dict,dict):
return None
for i in the_dict.keys():
isint = isinstance(the_dict[i],int)
displayed = 'Enter {}: '.format(
['your ','the '][isint]+str(i)
)
value = input(displayed)
result_dict[i] = int(value) if value.isdigit() else value
return result_dict
print(get_the_data(qualities))
# so in conclution, just give the function a dict to look at and you got your data nicely đ
+ 1
Do you mean that in sense that your code needs multiply lines of input? Because SoloLearn can take multiply lines of codes like that.
https://www.sololearn.com/post/1702905/?ref=app
(Note: each number's one line input)
edit: You must submit them all together!