-while learning python

"" "
The while condition:
When conditions are met, to do things
. If the condition has been met, has been deduplicated execute code
direct condition is not satisfied so far, to stop the cycle "
""
# salary = "0"
# the while int (salary) <40000:
# salary = the INPUT ( "I want to pay:")
# Print ( "continuous learning !!!")

The salary = 7000 #
# the while the salary <40000: # as long as conditions are met repeat code runs indentation. Until the condition is not satisfied so far.
# Print ( "continuous learning !!!")
# 5000 salary + =
# Print (salary)
# # If my monthly salary of 20,000, I will exit the loop.
Salary IF #> = 20000:
# Print ( "monthly salary of 20,000 does not learn, hey look !!!!")
# BREAK # key to exit the entire cycle.

# Change, to stop the cycle of conditions. Avoid endless loop.

#for traverse traverse: from start to finish, one and all to visit it.
# Set of data types: lists, dictionaries, strings, tuples
"" "
for the variable name in the list / dictionary:
every visit to a value (set), the code to be executed. "
""
Movies = [ "Magic founder "" armored steel fist "," Titanic "," complex with 4 "and" Transformers "]
# a way to navigate lists
for Item in Movies:
Print (Item)
IF Item ==" complex with 4 ":
Print ( "I most want to see the movie, came out !! I want to buy a ticket !!")
BREAK # exit the current cycle

Traversing the index list == # = 0,1,2,3,4 [0,1,2,3,4]
# Range () generates a sequence of integers.
# Range (start integer, integers end, step) starting an integer of 0 is default, default step size is 1. It does not contain the end of integers.
# Range (endpoint integer) Range (. 5) # [0,1,2,3,4]
# range (2,10) # [2,3,4,5,6,7,8,9]
# range ( 2,10,2) # [2,4,6,8]
# Range (10,2, -2) # [10,8,6,4]
Print (len (Movies))
#len (Movies). 5 =
Range # (len (Movies)) Range = (. 5) = [0,1,2,3,4]
for index in Range (len (Movies)):
Print (index)
Print (Movies [index])

Guess you like

Origin www.cnblogs.com/qsmyjz/p/11261177.html