Python Range Exercises Let’s check out some exercises that will help understand range() function better. Exercise 14-a Create a range from 0 to 50, excluding 50. #Type your answer here. rng= print(rng) ==== from unittest.gui import TestCaseGui class myTests(TestCaseGui): def testOne(self): self.assertEqual(rng,range(0,50),"rng checks") myTests().main() Hint 1 range() function can be used to create range type data. Solution rng = range (50)or rng = range(0,50) Exercise 14-b Create a range from 0 to 10 with steps of 2. #Type your code here. rng= print(list(rng)) ==== from unittest.gui import TestCaseGui class myTests(TestCaseGui): def testOne(self): self.assertEqual(rng,range(0,10,2),"rng checks") myTests().main() Hint 1 range() function can take 3 parameters. range(start, stop, step) Solution rng = range(0,10,2) Exercise 14-c Create a range from 100 to 160 with steps of 10. Then print it as a list. #Type your answer here. rng= print() ==== from unittest.gui import TestCaseGui class myTests(TestCaseGui): def testOne(self): self.assertEqual(rng,range(100,160,10),"rng checks") myTests().main() Hint 1 range() function can take 3 parameters. range(start, stop, step) Solution rng = range(100,160,10)print(list(rng)) Exercise 14-d Can you you create a list from 1300 to 700 with descending steps of 100? Is your stop value included in the list? # Type your answer here. rng= print(list(rng)) ==== from unittest.gui import TestCaseGui class myTests(TestCaseGui): def testOne(self): self.assertEqual(rng,range(1300,700,-100),"rng checks") myTests().main() Hint 1 range() function can take negative step as well. range(start, stop, -step) Solution rng = range(1300,700,-100) Exercise 14-e Can you you create a list from 1300 to 700 with descending steps of 100, this time including 700? # Type your answer here. rng= print(list(rng)) ==== from unittest.gui import TestCaseGui class myTests(TestCaseGui): def testOne(self): self.assertEqual(rng,range(1300,699,-100),"rng checks") myTests().main() Hint 1 range() function can take negative step as well. range(start, stop, -step) Solution rng = range(1300,699,-100)