The heart of programming is using if statements and looping. Search online to find differences in Python branching (decision) and repetition (looping) statements compared to other languages such as C++ and Java. Share your findings and your experiences learning selection and loops last week and this week of learning Python control structures. Give your citations.
The heart of
Some of the key differences between python's branching and repetition statements compared to other languages such as C++ and java are
1) In Python does not use curly braces to delimit the blocks of code as C++ and java do.
2) Pythons does not have traditional "for" loops like C++ and java. Instead, Python has a "For" loop that is more like a "foreach" loop in the other languages.
For example,
In java "for" loop lets you loop that breaks when a condition is met.
for(initialization; condition; increment){
// do something
}
The condition part will be considered true.
But in python "for" loop lets you loop over an iterator instead of a condition.
for value in list:
# do something
and it can take any forms
for i in range(100):
# run 100 times
Step by step
Solved in 2 steps