help in py? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

help in py?

SOLVED. Thanks for an amazing forum - always help to get for a newcomer as me in py :-) https://code.sololearn.com/cdrQ1c8T5fO8/#py

1st Jan 2022, 8:24 PM
mpssolutionsdk
mpssolutionsdk - avatar
5 Answers
+ 6
mpsorensen , there seems to be an input() missing. do this: ... kWh = float(input()) ...
1st Jan 2022, 8:56 PM
Lothar
Lothar - avatar
+ 4
Hi @Tibor Santa - thanks for reply. Actually just found out too. But amazing such little things can trouble soo much :) Again - thanks for spending time on me! Hope you have a great new year!
1st Jan 2022, 8:35 PM
mpssolutionsdk
mpssolutionsdk - avatar
+ 3
Add a comma inside your print statements, between the text and the number: print("Cost for electricity in 2018 =", float(kWh * yr18 * 7.45 / 10))
1st Jan 2022, 8:31 PM
Tibor Santa
Tibor Santa - avatar
+ 3
When you have multiple strings in a single print statement you have to separate them with a comma or concatenate them with a plus sign. Examples: print("a", "b") print("a" +"b") Notice that in the first case python inserts a space by default (you can override this behaviour). In the second case if you want spaces you have to provide them inside the quotation marks.
1st Jan 2022, 8:36 PM
Simon Sauter
Simon Sauter - avatar
+ 2
hey lothar, yeah thanks - was preparing it now... just need to figure out how to poste on a webpage now haha. hope u also have a nice new year!
1st Jan 2022, 9:01 PM
mpssolutionsdk
mpssolutionsdk - avatar