+ 1
How do i make like a "zip file" type inside inputs answer
Not the best wording i know but heres my issue. Say this is my code S = input ("5 Names : ") Print(S) From here i want to input say. The number 2 but i want it to print out whatever i have attached to the number 2. Ex. Instead of (5 names: 2) Answer: 2 I want: (5 names: 2) Answer: Matthew, Chris, Joe, Amy, Theadorheimervanglson Smith đ nice name. I know
6 Answers
+ 7
#I guess you want something like this
dct = {'1': 'n1 n2 n3 n4 n5',
'2': 'n6 n7 n8 n9 n10'}
i = input()
print(dct[i])
+ 6
Kidale Smith It does seem you are struggling to explain your issue. I feel you are close to making it clear.
But... yeah... it's a bit tough to follow in it's current wording.
I'll ask a few questions that might help you fill in the blanks in clarifying the question.
1. I was thrown off by your reference to "zip file" type in the question. I was originally thinking you were asking about archiving files in a compressed zip file.
However, it seems you may be referring to the "zip() function" which would completely change the context here.
Is this the case?
2. Why is 2 being inputted for what appears to be requesting 5 names to be entered?
The labels are confusing here. Is the code requesting the user to input a number or 5 different names?
3. When entering 2, why would the code output 5 different names? What would have happened if the user entered 1 or 10 or 1000?
4. Would entering 2 actually return the second name: Chris?
+ 4
I don't get it. What does "print out whatever I have attached to the number 2" mean?
0
David Carroll wow. After coming back to this i see i was still new and didn't know how to explain. So. This is what i mean to do.
Instead of "5 names:" i want to enter "one name" like you said we'll use "chris"
After entering "Chris" i want to see all 5 names.
Example:
Answer = Chris:
Output:
-Rob
-Jon
-Bill
-Sandy
-Poppabillywonga
0
Mert Yazıcı what what whaaaat. That looks AMAZING i'll try it
0
Anna sorry. I confused everybody. My questions all screwed up. To make it short i mean like this. I'll use numbers since i know i can't use numbers with strings now.
If i input this answer: 2
This will be the output: 1,2,3,4,5
Because 1,2,3,4,5 is tied to the answer 2.
But i wanted names tied to it. Which i think is impossible