+ 2

What's wrong with my code pls help me

I has written a code this https://code.sololearn.com/c9QUqkkT8GJU/?ref=app This is not working properly pls anyone help me

15th Jun 2021, 12:07 PM
Tirthor's Gaming
Tirthor's Gaming - avatar
38 Réponses
+ 5
a = input("enter the amount: ") b = input ("enter no. of days: ") The above 2 lines accept 2 inputs of string type. And displays string given in input("sting argment") argument. And next print (" a * * b ") just print string 'a * * b' because you added it in Quotes so it becomes a normal string... Remove quotes and space between as print(a**b) this does expression of a power of b. Before this you need convert input into integer type from string type as a = int( input( "a value \n") here \n adds new line in output.. make these changes and try... to convert float use a=float(input())
15th Jun 2021, 12:17 PM
Jayakrishna 🇮🇳
+ 3
Tirthor's Gaming print(a**b) You used expression inside a string. And , make your inputs as float. a=float(input("enter the amount: ")) b=float(input("enter no. of days: ")) And if you want to print input prompt strings in line by line, you can use \n to do this. a=float(input("enter the amount: \n")) If you want to input a integer, you can use int() function . a=int(input("enter the amount: \n"))
15th Jun 2021, 12:11 PM
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜ - avatar
16th Jun 2021, 6:51 PM
Daniel Kagombe
Daniel Kagombe - avatar
+ 2
You have printed a string a**b but not it's result. To print the result of a**b remove double quotes in the print statement. If you use double or single quotes in a print statement, you are telling the compiler to print a string. Avoid unnecessary spaces tooo. (in between operators) You should also specify the type of the input to be taken... Use this code for your required output - a = int(input("enter the amount: ")) b = int(input("enter no. of days: ")) print (a**b)
17th Jun 2021, 2:39 AM
Dondapati Eswara Satya Sai Rama Rohith
Dondapati Eswara Satya Sai Rama Rohith - avatar
+ 1
What are you trying with this code? Add details..
15th Jun 2021, 12:09 PM
Jayakrishna 🇮🇳
+ 1
What output do you expect from the program? Please give example. Remember: input returns a string. You need convert in case you require a numeric type.
15th Jun 2021, 12:14 PM
Lisa
Lisa - avatar
+ 1
a = float(input("enter the amount:\n")) b = float(input("enter no. of days:\n")) print (a**b) #this is corrected code .. see changes and understand..Tirthor's Gaming
15th Jun 2021, 12:25 PM
Jayakrishna 🇮🇳
+ 1
Tirthor's Gaming in that problem,you don't need any input. "The problem is -ones salary is 0.01$ doubled every day for 30 days and other ones is 1.000.000$ . so find which one salary is high and print high salary". There are details given how to do with an example. Understand and apply to problem...
15th Jun 2021, 12:47 PM
Jayakrishna 🇮🇳
0
I am doing test in learn section
15th Jun 2021, 12:11 PM
Tirthor's Gaming
Tirthor's Gaming - avatar
0
Ohh thx
15th Jun 2021, 12:12 PM
Tirthor's Gaming
Tirthor's Gaming - avatar
0
Output = $0.01 powered by 30
15th Jun 2021, 12:15 PM
Tirthor's Gaming
Tirthor's Gaming - avatar
0
Then also it is saying no input
15th Jun 2021, 12:16 PM
Tirthor's Gaming
Tirthor's Gaming - avatar
15th Jun 2021, 12:16 PM
Tirthor's Gaming
Tirthor's Gaming - avatar
0
Help me
15th Jun 2021, 12:16 PM
Tirthor's Gaming
Tirthor's Gaming - avatar
0
Thx
15th Jun 2021, 12:18 PM
Tirthor's Gaming
Tirthor's Gaming - avatar
0
You are so genius
15th Jun 2021, 12:19 PM
Tirthor's Gaming
Tirthor's Gaming - avatar
0
Can you pls make a code and send me
15th Jun 2021, 12:20 PM
Tirthor's Gaming
Tirthor's Gaming - avatar
0
Pls
15th Jun 2021, 12:20 PM
Tirthor's Gaming
Tirthor's Gaming - avatar
0
I will perfectly understand
15th Jun 2021, 12:21 PM
Tirthor's Gaming
Tirthor's Gaming - avatar
0
Ok. But why don't you try... I already explained in details what changes you need. Try and post.
15th Jun 2021, 12:24 PM
Jayakrishna 🇮🇳