### Thread: New to Python, need help

1. No Profile Picture
Registered User
Devshed Newbie (0 - 499 posts)

Join Date
Feb 2014
Posts
5
Rep Power
0

#### New to Python, need help

this is really driving me nuts and i know i need an accumulator...any help in finishing this program assignment would be appreciated.

here's what i have so far, basically i need it to tally up the amount that's displayed based on the days entered by the user.

--------------
def main():
print ("This program will calculate your pay if you made only a penny")
print ("a day for the amount of days you in put. The program will then")
print ("total how much your pay would be during that time.")
print ("\n")

#days is defined to what the user inputs as the amount of days
#furthermore, days is defined to be an integer
#money is defined as equaling 0.01 (the start point of the assignment)

total_accum = 0.00
days = input('Please enter the amount of days you worked: ')
days = int(days)
money = 0.01

#this prints the table that will organize the results
print ("Days\tAmount Earned")
print ("-------------------")

#this loop tells the program to add 1 to each day, and later on eventually
#telling the program to take what money is, and multiply it by 2
for day in range (1, days + 1):
print ("Day", day, "\t", "\$",money)
money *= 2

#this program will then show the total for all days and tally it up

main()
2. One would think
Code:
```for day in range (1, days + 1):
print ("Day", day, "\t", "\$",money)
total_accum += money
money *= 2```
However, another one might realize that
Code:
```for day in range (1, days + 1):
print ("Day", day, "\t", "\$",money)
money *= 2
total_accum = money - 0.01```
Still another would count by integral pennies rather than floating point dollars, producing an exact answer.
3. No Profile Picture
Registered User
Devshed Newbie (0 - 499 posts)

Join Date
Feb 2014
Posts
5
Rep Power
0
thank you! so simple yet i couldn't think of it myself. this assignment had been driving me up a wall. taking an intro to programming course in aspirations of getting a degree in IT network security. surprisingly enough i'm told by most of my friends i know in the same industry, i'm told programming isn't used too frequently in the network security field.

once again, i appreciate your help!