I have been learning Python for two weeks now I created a function which displays your biographical data. I want to know how to put objects of different data types into one string
As you can see, the data includes strings, an int and a boolean. I want to be able to display them as a single string. So far my function only displays them individually like this: ('1000000', 'Bob', 17, False) I want to it display like this: '<1000000,Bob,17,False>'
def student_data(name, age, student_number, enrolled):
age = int(age)
true = "true"
false = "false"
# check to see if user is enrolled or not.
if enrolled == true:
enrolled = True
else:
enrolled = False
data = (student_number, name, age, enrolled,)
return (data)
data = student_data("Jana", 17, "1001291657", "false")
print (data)
TrueandFalse. Otherwise people will look at you funny...