# Name: #
# While Loop Exercise
#
# Overview:
# * This assignment contains questions each comprised of
# a print statement that specifies what the output for
# that question should look like.
# * Write a single while loop for each question.
#
# Instructions:
# * Copy this file and add while statements to get the
# specified behavior.
# * Do not delete anything from this file.
# * Fill in your name at the top of the file.
# * The first exercise is implemented as an example.
# * Implement the while loops one at a time in the
# order they occur in the file.
# * Test your program with various inputs and make sure
# each loop is correct before going on to the next.
# * If the end value is not in the sequence then the last
# number output should be the last number in the sequence
# less than the end value.
#
# Requirements:
# * See the requiremets on the assignment page.
#
# Points will be deducted for requirements not fulfilled.
#
# Run notes:
# * The input will cause the prompt message to be output
# and will wait for the user to type a number.
# * After the input statement has executed the variable limit
# will have for its value the value the user typed.
# * If, for example, limit has the value 10 the the expression
# (limit 1) is 9, thus 1 2 3
(limit 1) means
# 1 2 3 4 5 6 7 8 9
#
# Print command notes:
# * Use a print similar to the one given in the first loop
# to cause a space only (on newline) between each output
#
# Implementation notes:
# * DO NOT CHANGE THE VALUE OF THE VARIABLE limit.
# * If the sequence is not clear plug a specific value in
# for limit (8 or 10 for example) and see what it looks like.
# * If the last value specified for output not in the
# sequence then output then output the value that
# occurs in
the sequence immediately before it
# as the last value output.
#
# Additional notes for specific loops:
# 9. What happens if limit is odd? (Just observe what happens.)
# 12. Example output with limit of 10: 10 7 4 1
# 13. Example output with limit of 6: -6 -5 -4 -3 -2 -1 0
# 15. Example output with limit of 6: -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6
# 16. The output will be floats due to the necessary division.
# Example output with limit of 10: -5 -4 -3 -2 -1 0
# What happens if limit is odd? (Just observe what happens.)
# 17. The output will be floats due to the necessary division.
# Define and use a variable named half_limit
# What happens if limit is odd? (Just observe what happens.)
# 18. Do not use the exponentiation operator **.
# Use the counter variable to compute each square.
# 19. Output limit number of factorials.
# ! denotes factorial, example:
# 5! = 1 * 2 * 3 * 4 * 5
# Use a variable named factorial to accumulate the factorial in.
# Each iteration use the accumulated value and the loop
# counter to compute the next factorial value.
# 20. Output powers of 2.
# There should be limit number of powers output.
# Do not use the exponentiation operator **.
# Use a variable named powers to accumulate the powers in.
# (Each iteration use the accumulated value and
# compute the next power of 2 value.)
# 21. Output a single value only, the sum.
# If the value in limit is 4 the output value should be 10 (1 + 2 + 3 + 4).
# Use a variable named sum to accumulate the sum in.
# (Each iteration use the accumulated value and the loop
# counter to compute the next sum value.)
#
#==========================================================
# Prompt, input a value
limit = input(Enter a value for limit: )
limit = int(limit)