AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Data in detail

Week 7 · 1.5 Programming with data · 3 lessons
Answers are for parents and teachers.
1
Choose the best data type for each: the number of goals in a match, a price of 4.50, a pupil’s name, whether the lights are on, and the first letter of a name.
2
Work out what these two lines print: print(int("15") + int(2.9)) and print("15" + str(2)).
3
The program starts with word = "Mountain". Write the index of every letter, then say what word[2], word[7] and len(word) give.
Python
1word = "Mountain"
2print(word[2])
3print(word[7])
4print(len(word))
4
Write a program that asks for a word and then prints it with one character on each line, using a for loop.
5
Explain why the loop line is range(len(word)) and not range(len(word) + 1). What happens with the second one?