Added task 3
This commit is contained in:
16
basic programming/3rd task/5.py
Normal file
16
basic programming/3rd task/5.py
Normal file
@@ -0,0 +1,16 @@
|
||||
def sequence_has(txt: str) -> bool:
|
||||
i = 0
|
||||
while i < len(txt) - 1:
|
||||
if txt[i] == txt[i + 1]: # אם יש תו שחוזר ברצף
|
||||
return True
|
||||
i += 1
|
||||
return False
|
||||
|
||||
def main_5ex():
|
||||
txt1 = "apple"
|
||||
print(f'{txt1} contains a sequence' if sequence_has(txt1) else f'{txt1} does not contains a sequence')
|
||||
|
||||
txt2 = "banana"
|
||||
print(f'{txt2} contains a sequence' if sequence_has(txt2) else f'{txt2} does not contains a sequence')
|
||||
|
||||
main_5ex()
|
||||
Reference in New Issue
Block a user