Professional Documents
Culture Documents
Loops
Note:
• With + operator to add a int statement to a String statement,
int value’s type must be changed to String.
print(String + String) (ok)
print(int + int) (ok)
print(String + int) (wrong)
print(String + str(int)) (ok)
print(int + String) (wrong)
print(int(String) + int) (ok)
1. Guess my number:
User tries to find the number that is assigned to a variable (by
the programmer).
Program gives outputs such as “too low”, “too high” or “you
guessed it”. Program finishes when user finds the number.
Note: Use the following structure to increase a numeric variable a curtain amount of value(2):
number += 2 or number = number + 2