0
Code challenge Test Inputs
Hello, i'm new to Sololearn (and programming) and i got confused with the input in a Code challenge: i did the paint cost one and used the print command for the first test and it worked but at the second one i just took it into a new one (tried in the same one 2) but it said, the code would be wrong, while my result was the one for the first 2 tests, but it semmed to want them kind of seperated but still in the same output. Can ayone please explain me how is meant to be?
7 odpowiedzi
+ 6
You are supposed to take input. Do not hard-code the values.
If you need help with your code, show your code attempt. Tag the relevant programming language.
+ 2
Wenn sololearn deinen Code testet, fügt es input ein wie ein Benutzer input eingeben würde.
* Verwende input() und speichere die Eingabe in eine Variable, z.B. inp = input()
* Konvertiere den Wert der Variable in einen numerischen Datentyp, z.B. mit float().
* Übergib die Variable als Argument deiner Funktion.
* print() das Ergebnis nur einmal.
Beachte, dass wir das Ergebnis nicht runden, sondern **auf**runden sollen. Hierzu kannst du die Funktion ceil() aus dem math module importieren:
from math import ceil
ceil(1.23) # 2 (Beispiel)
+ 1
Yes, hidden test cases remain hidden.
0
def kosten(p):
cost = 1.1*(40+5*p)
return round(int(cost))
print(kosten(2),kosten(20))
#Fall 2
#print(kosten(20))
Python
Thank you very much
0
Tried as alternative print just seperated prints for both inputs
0
Ok thank you, i forgot the change of the input
Is it normal that the system doesnt show all the test values? It did for mine just show 2 ones but controlled all 5
0
Ok thanks 👍