neděle 30. prosince 2018

idiomatic array input

# a dictionary, it's a list of (key : value) pairs (eg. "Maths" : 34)
marks = {}
subjects = ["jmeno", "prijmeni", "vek", "pohlavi", "work"]  # this is a list

# here we populate the dictionary with the marks for every subject
for subject in subjects:
    marks[subject] = input("Enter the " + subject + " marks: ")
print(marks)

Žádné komentáře:

Okomentovat