how to take a String argument within a function returned as a tuple

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP

how to take a String argument within a function returned as a tuple



Okay so what I wanted was trying to do was cycle through the string arguments and then try add it into the tuple however I am unable to do that and I'm currently using the print(tuple()) method.
I want to use return rather than print too.


print(tuple())



Any help is much appreciated, I am a beginner in this too !



currently what results I get, doubled words and of course because I used a for
loop it adds each letter separately, so far this is the closest I've gotten


def part1 (payroll, dept, salary, firstname, lastname):
tuple1 = ()


for i in payroll:
payroll = payroll + i
for i in dept:
dept = dept + i
for i in salary:
salary = salary + i
for i in firstname:
firstname = firstname + i
for i in lastname:
lastname = lastname + i

print(tuple(payroll))
print(tuple(dept))
print(tuple(salary))
print(tuple(firstname))
print(tuple(lastname))

part1('13214', 'CSEE', '27000', 'joey bob', 'Smith')



my desired output would be


(13214 CSEE 27000 joey bob Smith)





Can you provide an example input and desired output?
– Mateen Ulhaq
7 hours ago





yeah I just edited it and add some more details as well as a pic of what the results were
– Peanut HeadShape
7 hours ago




1 Answer
1


def part1(partonelist):
return tuple(partonelist)

if __name__ == "__main__":
part1_list = ['13214', 'CSEE', '27000', 'joey bob', 'Smith']
my_tup = part1(part1_list)
print(my_tup)



It's a little cleaner to put them in a list... then simply call the tuple function.



This will print:
('13214', 'CSEE', '27000', 'joey bob', 'Smith')





I said the same thing hah. It seemed like he wanted a client to call a function though
– James Colley
6 hours ago






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

Executable numpy error

PySpark count values by condition

Trying to Print Gridster Items to PDF without overlapping contents