Rückkehrungen und Schwimmer in Python -FunktionenPython

Python-Programme
Anonymous
 Rückkehrungen und Schwimmer in Python -Funktionen

Post by Anonymous »

Ich muss eine Funktion erstellen, die einen Satz mit Variablen zurückgibt. Aber wie schließe ich alle speziellen String -Zeichen aus, die ich nicht brauche? (z. B. ( oder, oder ')

Code: Select all

ef area_of_triangle( bottom, height ):
area = 0.5 * bottom * height
return 'The area of a triangle with a bottom of', bottom, 'and a height of', height, 'is', area, '.'
Dies ist vorerst mein Code, aber die Ausgabe enthält immer Klammern, Kommas und Apostrophes. 1.0, '.')
Anstelle von: Der Bereich eines Dreiecks mit einem Boden von 2.0 und einer Höhe von 1.0 beträgt 1.0.>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post