Python- Beginner

I am working on Tuples and i want to print the red one as same as blue. But it includes (),"" as (35, ‘and’, 36). how can i remove it while keeping str

Hey there! Welcome to the forums :wave: :slightly_smiling_face:

You could have the function format ages first. Loop though the tuple and convert each to a string, then join them around a space:

Spoiler warning
new_ages = []
  for i in ages:
    new_ages.append(str(i))
  new_ages = ' '.join(new_ages)

or simpler:

ages = ' '.join([str(i) for i in ages])

Seems like a kinda messy way to pass the arguments though. Perhaps a dictionary would be better? You could pass a single argument with every persons name and age:

people = {
  "Jane": 20,
  "John": 25,
  "Jessy": 32,
  "James": 41
}
2 Likes

Yes that’s possible. Btw thank you.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.