Ich habe die Funktion .pop () verwendet, um die Gäste zu entfernen. Hier ist mein Code:
guests = ['Bill' , 'john' , 'jason' , 'fatima' , 'muhammed' , 'abdul']
print(guests)
guests.pop('jason')
guests.pop('bill')
print(guests)
print("Jason could not come because he got sick.")
print("Bill could not come because he had to go to a funeral.")
print(guests)
< /code>
Ich dachte, dass es diese beiden Namen herausholen würde, aber stattdessen habe ich einen Fehler erhalten: < /p>
STR -Objekt kann nicht als Ganzzahl interpretiert werden.>
Array.pop ('Name') führt zu einem Fehler: "STR -Objekt kann nicht als Ganzzahl interpretiert werden" ⇐ Python
-
- Similar Topics
- Replies
- Views
- Last post