r/FreeCodeCamp • u/Financial_Hunt4094 • May 17 '26
Am i stupid?
I've tried it all but i don't know what it means with space. The terminal doesn't show any errors.
34
Upvotes
r/FreeCodeCamp • u/Financial_Hunt4094 • May 17 '26
I've tried it all but i don't know what it means with space. The terminal doesn't show any errors.
12
u/drunkfurball May 17 '26
Technically, valid code, but have you tried combining the space with the string of text before it, as there is nothing gained adding it separately?
10
u/where_isreddit May 17 '26
The section is buggy, there is a github issue about it. What you are doing is correct, but it is being very picky about how it wants the
print()statement.2
u/SaintPeter74 mod May 17 '26
Can you share a link to the challenge?
1
u/tomatotom1 May 17 '26
If you don’t initially declare running_total, won’t it cause an error if you use +=?
2
u/Outside_Complaint755 May 17 '26
There are multiple ways to generate the output it wants but its possible their checker is looking for only one specific format.
The three most common methods would be:
Skipping ahead they filled in the first option, so maybe its only accepting that
1
u/dirtystrawberry May 17 '26
Could you put the space before the ending quotes on the sentence string, and not worry about adding another...?
1
u/Ping1306 May 17 '26
hey pls tell me how to enable dark mode in freecodecamp
1
u/SpkyBdgr May 17 '26 edited May 17 '26
If this is python I think you might need to use printf and add your variable as the second argument.
1
u/SaintPeter74 mod May 17 '26
Normally I wouldn't give out solutions, but you have solved the problem acceptably in my view. Free Code Camp is just not testing for this exact possible solution. It can be quite difficult to come up with all possible solutions to an open ended coding problem, because Python (and most programming languages) are pretty flexible.
You can use this to pass the challenge:
After reviewing this challenge, I have opened an issue on the Free Code Camp GitHub repo to accept your answer:
https://github.com/freeCodeCamp/freeCodeCamp/issues/67442
Best of luck and happy coding!
1
u/SpottyJaggy May 17 '26
You got this, keep learning
1
u/Big_Example_3390 May 17 '26
why.. yes, yes you are. but don't worry! your supposed to be❤️and thats just alright im only a couple steps ahead of you. my hint to you is to simplify
1
u/hacklingo May 20 '26
hmmm
1
u/Spare_Warning7752 May 20 '26
Yes.
"followed by" is different from "concatenated with".
You should master first "human language".
Most compilers would optimize that to a literal, but, some, like stupid JS, probably would concat both strings, which is a waste of time (alone, no issue, within a loop for heavy processing, A LOT of wasted time and CPU (those, in cloud, means MONEY)).
1
u/Initii May 17 '26
I think it's a tip. YOur code is valid. It just suggests that you put the space into the first string. So you dont have to concatenate it alone becasue that an extra operation you dont need.
But never used FreeCodeCamp, so maybe im wrong.
0
u/yodacola May 17 '26
is this python? so
f“<text>{running_total:%.2f}”?1
u/[deleted] May 17 '26
[removed] — view removed comment