Which statement do I use!?? | SoloLearn: Learn to code for FREE!

0

Which statement do I use!??

Here is my homework question: Design a program that calculates the amount of money a person would earn over a period of time if his or her salary is one penny the first day, two pennies the second day, and continues to double each day. The prog. should ask the user for the number of days worked. Display a table showing what the salary was for each day, and then show the total pay at the end..." I am so confused on how to get my code to work! How do I use a while statement run, if the limits are whatever the user inputs?!?!

2/22/2017 2:15:22 AM

auri

8 Answers

New Answer

+6

Raj code is bettet

+5

maybe you can add this line: days=int(input("enter your salary days:") that line will change user input into integer then you can set limit of iteration by something like this: i=1 while i<=days:

+2

If I use For, how can I get the table I need to print the days (ie 1,2,3) in order? Sorry I am a super newb at this. Also how the heckkk do I write the user input code? Int(input? Float(input? Just input?! I'm so lost any help is very much appreciated

+2

Thank you guys so much! Raj you are gods gift to python noobs haha :) Auri

+1

hey here is code for you https://code.sololearn.com/c8b1832eN8VQ/?ref=app you can modify according to your need.

+1

check it now, now its more according to your need https://code.sololearn.com/c8b1832eN8VQ/?ref=app

0

It is GM series, total pay till n will be (2^n-1) and table will keep multiply by 2 till we have n.

0

Auri...saying god gifted to a learner like me is a wrong choice of word. but still I appreciate your feelings :p but yeah you shouldn't post your homeworks here, if you are struck from somewhere ..ask for that. or if needed ask for logic but at last try to code by yourself . now you dont just copy my code...code by yourself and ask me if have any doubt. cheers..have a good day :)