My QA Projects

QA Projects I was involded.

View on GitHub

Loop Control Structures

Infinte Loops

while True:
    codeblock

Break

if boolean_exp:
    break
string = "apple,banana,orange"

# Splitting the string using comma as separator
result = string.split(',')

print(result)  # Output: ['apple', 'banana', 'orange']
while True:
    s = input("Enter a sentence: ")
    if len(s) == 0:
        break
    words = s.split()
    #If no separator is provided to the split(), it splits the string based on whitespace characters by default.
    print(f"{len(words)} words")
    print("done")

Continue

if boolean_exp:
    continue
while True:
    s = input("Enter a sentence: ")
    if len(s) == 0:
        continue
    words = s.split(
        print(f"{len(words)} words")
    print("done")
    )