0
Plz explain your code i do not understand this code plz explain
def new_string(str): if len(str) >= 2 and str[:2] == "Is": return str return "Is" + str print(new_string("Array")) print(new_string("IsEmpty"))
1 Odpowiedź
0
The if statement checks if the given value is 2 or more and if the first letter is I and the second letter’s s. If so the function will return the given value (function always stops after it returns). If the statement is false it will return Is + the given value.