# Problems

## Problem 1

Using a while loop, print numbers from 1 to 10.

![](/files/-LvcJODc3Q1Ec3M17yPi)

## Problem 2

Ask the user what town they live in.  Using a while loop, print the name of their town 4 times.

![](/files/-LvcJg-6uxuALhRdIGa1)

## Problem 3

Using a while loop, print the powers of 2 from $$2^0$$to$$2^9$$&#x20;

![](/files/-LvcLQ3TXsFvjDSX1y3j)

## Problem 4

Using a while loop, print even numbers from 0 to 100.

## Problem 5

Using a while loop, print the sum of the first 100 numbers. (1 + 2 + 3 + ... + 100)

![](/files/-LvcJxBOztt3kikexiEk)

## Problem 6

You work for five days.  Using a while loop, ask the user how much money they make each day. Print how much money they have after five days.

![](/files/-LvcKUcwhuezD8vsi0gg)

## Problem 7

First, ask the user for their name.  Second, ask the user how many times they want to print their name.  Using a while loop, print the user's name the number of times they specified.

![](/files/-LvcKpcIllc-trHLC82m)

## Problem 8

Ask the user for a number.  Using a while loop, print the squares from 1 to this number.

For example, if the user enters 10, you'll program will print:

![](/files/-LvcJ7nhHjnuk1-bWMwZ)

## Problem 9

Ask the user for two numbers, a and b. Print the sum of all the numbers between a and b (inclusive).

## Problem 10

Ask the user for two numbers, a and b.  Using a while loop, print the odd numbers between a and b (inclusive).  How do you figure out if a number is even or odd?

## Problem 11

Ask the user for two numbers, a and b.  Using a while loop, print the sum of the odd numbers between a and b (inclusive).

## Problem 12

You put $10,000 into a bank account that earns 5% interest per year.  The interest formula is:

$$
A=P(1+r)^t
$$

$$A=amount$$&#x20;

$$P=Principal$$&#x20;

$$r=rate$$(in %)

$$t=time$$(in years)&#x20;

a) Print the balance per year until the time in years.

b) How many years will it take for the account balance to double the original investment?  Estimate this by inputting different amounts of time.

c) How many years does it take to triple?

![](/files/-LyWC_AcmytrCfxYdrmS)

### Challenge

c) The Swiss National Bank (SNB) is charging a 0.75 percent fee on large deposits at the central bank, a cornerstone of its monetary policy since January 2015 which is aimed at weakening Switzerland’s currency. &#x20;

If Swiss banks paid 970 million Swiss francs ($1 billion) in negative interest rate charges in the first six months of 2017, how much in deposits do Swiss banks have?

How many years will it take for the balance to be 0.<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.pythonclassroom.com/loops/while-loop-count-up/exercises.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
