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


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


8 Answers

New Answer


Raj code is bettet


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:


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


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


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


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


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


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 :)