Sie sind auf Seite 1von 5

ULO 3 - Let’s Try

Define

1. (a.) Create a simple flowchart on how the “break” statement works in Conditional and
Looping (b.) Create your OWN example code.

Start User
input

For inputs in user


input

False
If inputs ==
user input

True

Yes
Break?

No Print “Ends
here”
Print
inputs

End
# code here
string = input("Enter a string: ")
letter = input("Enter the string you want to break: ")
for input in string:
if input == letter:
break
print(input)

print("Ends here")

2. (a.) Create a simple flowchart on how the “continue” statement works in Conditional and
Looping (b.) Create your OWN example code.

Start User
input

For inputs in user


input

False
If inputs ==
user input

True

Yes
continue?

No Print “Ends
here”
Print
inputs

End
# code here
string = input("Enter a string: ")
remove = input("Enter the string you want to remove: ")
for input in string:
if input == remove:
continue
print(input)

print("Ends here")

3. (a.) Create a simple flowchart on how the “Else” statement works in Conditional and
Looping (b.) Create your OWN example code.

Start

Input
Number

If Number % 2 == 0

Print number Print number


is Even is Odd

# code here
num = int(input("EnterEnda number: "))
if (num % 2) == 0:
print("{0} is Even".format(num))
else:
print("{0} is Odd".format(num))
4. (a.) Create a simple flowchart on how the Nested Loops works? (b.) Create your OWN
example code
Start

Initialization

False
Condition 1 Increment/

decrement
True

Increment/
False
Condition 2 decrement

True

statements

End for

End for

# code here
price = ["$10", "$20", "$30"]
End
food = ["fries", "Hamburger", "Spaghetti"]
i = 0;
for x in price:
i += 1
for y in food:

print(x, y, i)

Das könnte Ihnen auch gefallen