Python Institute PCEP - Certified Entry-Level Python Programmer (PCEP-30-02 Deutsch Version) - PCEP-30-02 Deutsch Exam Practice Test

Fügen Sie die Codefelder an den richtigen Positionen ein, um eine Codezeile zu bilden, die den Benutzer nach einem Float-Wert abfragt und diesen der Massenvariable zuweist.
(Hinweis: Einige Codefelder werden nicht verwendet.)
Correct Answer:

Explanation:

One possible way to insert the code boxes in the correct positions in order to build a line of code that asks the user for a float value and assigns it to the mass variable is:
mass = float(input("Enter the mass: "))
This line of code uses the input function to prompt the user for a string value, and then uses the float function to convert that string value into a floating-point number. The result is then assigned to the variable mass.
You can find more information about the input and float functions in Python in the following references:
* [Python input() Function]
* [Python float() Function]
Was ist das erwartete Ergebnis des folgenden Codes?
Correct Answer: A
Explanation: Only visible for TrainingDump members. You can sign-up / login (it's free).
Was trifft auf Ausnahmen in Python zu? (Wählen Sie zwei Antworten aus.)
Correct Answer: A,B
Was ist die erwartete Ausgabe des folgenden Codes?
Correct Answer: C
Ordnen Sie die Codefelder an den richtigen Positionen an, um eine bedingte Anweisung zu bilden, die garantiert, dass eine bestimmte Anweisung ausgeführt wird, wenn die Geschwindigkeitsvariable kleiner als 50,0 ist.
Correct Answer:

Explanation:

One possible way to arrange the code boxes in the correct positions to form a conditional instruction which guarantees that a certain statement is executed when the speed variable is less than 50.0 is:
if speed < 50.0:
print("The speed is low.")
This code uses the if keyword to create a conditional statement that checks the value of the variable speed. If the value is less than 50.0, then the code will print "The speed is low." to the screen. The print function is used to display the output. The code is indented to show the block of code that belongs to the if condition.
You can find more information about the if statement and the print function in Python in the following references:
* Python If ... Else
* Python Print Function
0
0
0
0