[Tutor] Cube root
Ok, I have to get input from a user ('enter a number') and then get the cube root of that number. I am having trouble with the code to get the cube root. If anyone can help me solve this I would greatly appreciate it. ('enter a number') n=number ??? cube root?? -- Amanda Colley ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] using the loop function while another
Ok, here is my problem. If a person has two different people to order books for, then when using the loop option, How do you add the two seperate choices together for a final total of books cost? another='y' while another=='y' or another=='Y': choice() another=input('Do you have another book to order for this student? '+\ 'Enter y for yes: ') def choice(): book=int(input('Enter the book chioce you want: ' +\ 'For Hardback Enter the number 1: ' +\ 'Paperback Enter the number 2: ' +\ 'Electronic Enter the number 3: ')) num=int(input('Enter how many you need: ')) cost=0 if book==1: cost=79 elif book==2: cost=49 elif book==3: cost=19 b_total=float(cost*num) print('Your book cost is $ ',format(b_total,'.2f')) -- Amanda Colley ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Problems ugh help please
I am trying to add the total pounds that will be shipped. I keep getting an error of unknown format code 'f' for object of type 'str' when I try to float the pounds. and when I dont float it it gives me a total weight of when it exicutes. here is the code I have. def pounds(): h_book=weight('Hardback',2.1) p_book=weight('Paperback',1.3) print('Your total weight of book(s) at',pounds) return pounds def weight(desc,weight): print('How many',desc,'books do you want at',weight,'pounds do you want?') num=int(input()) pounds=float(num*weight) -- Amanda Colley ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor