Generate odd numbers by a list comprehension. Solve Exercise 2.4 using a list comprehension (with for and range). Name of program file: odd_list2.py.
Exercise 2.4
Store odd numbers in a list. Modify the program from Exercise 2.3 to store the generated odd numbers in a list. Start with an empty list and use a while loop where you in each pass of the loop append a new element to the list. Finally, print the list elements to the screen. Name of program file: odd_list1.py
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here