40 likes | 113 Views
What is x? x = 12 % 5 5 12 0 1 2 3 4. Here’s a program: text = “mongoose” print text[1] What does Python print? m o mongoose ongoose. Here’s a program: text = “mongoose” print text [-1] What does Python print? m o e em (Python gives an error).
E N D
What is x? x = 12 % 5 • 5 • 12 • 0 • 1 • 2 • 3 • 4
Here’s a program: text = “mongoose” print text[1] What does Python print? • m • o • mongoose • ongoose
Here’s a program: text = “mongoose” print text[-1] What does Python print? • m • o • e • em • (Python gives an error)
Here’s a program: text = “mongoose” for item in text: print item, What does Python print? • mongoose • m o n g o o s e • m • m o • (Python gives an error)