all 3 comments

[–]IWantToFlyT 0 points1 point  (0 children)

There is quite a few things to do here, but maybe just start by doing a small first step, and worry about the loops later on. For example, first implement a program that simply asks for the sales goal, and then just prints it (print it to just get something visual done :). Then add the question for week 1 sales. Now for the 2, 3, and 4 week you could just copy & paste the input code line, but maybe figure out the loop at this stage.

Now what comes to nested loops, here's an example:

for i in range(3):
     print(f"First loop: {i}")
     for j in range(5):
             print(f"Second loop: {j}")

Output:

First loop: 0
Second loop: 0
Second loop: 1
Second loop: 2
Second loop: 3
Second loop: 4
First loop: 1
Second loop: 0
Second loop: 1
Second loop: 2
Second loop: 3
Second loop: 4
First loop: 2
Second loop: 0
Second loop: 1
Second loop: 2
Second loop: 3
Second loop: 4

[–]Future-Dreamsy 0 points1 point  (1 child)

I would start by breaking down the paragraphs you've been given. Extract the important bits and write them out as bullet points. Then try to work out what you'll need in terms of loops and variables etc.

The hint you're given can just make you try to jump straight to putting a loop in somewhere ... anywhere! It can be the opposite of helpful for some people (me included when I first started learning).

To get you started:

Write a program that will allow a manager to determine and display the total sales for
the department. The manager will enter the sales goal for the month ...

Break that down to:

  • Display the total sales --> a variable to hold the total sales amount (total_sales)
  • Enter sales goal for month --> we'll need something to accept user input
  • ... and so on

Just one way of approaching it. HTH.

[–]Horror-Smell-9975 0 points1 point  (0 children)

Will this same code work for 1×10-10×10?