Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- # Released under a GPLv3 Licence by Clockwork PC 2014
- # www.clockworkpc.com.au
- # You are entitled to the following four freedoms:
- # Freedom 0: To run this program for any purpose
- # Freedom 1: To study how this program works and change it to make it do what you wish
- # Freedom 2: To redistribute copies so you can help your neighbour
- # Freedom 3: To distribute copies of your modified version to others
- # The Sequence of Bridges from #0 to #180
- bridgeNumbers = range(181)
- print bridgeNumbers
- print ""
- # The sum of the sequence of Bridges
- sumBridgeNumbers = sum(bridgeNumbers)
- print "The sum of the numerical values of all the bridges is: ",sumBridgeNumbers
- print ""
- # A list of even Bridges
- evenBridgesList = [x for x in bridgeNumbers if x % 2 == 0]
- print evenBridgesList
- print ""
- # A list of odd Bridges
- oddBridgesList = [x for x in bridgeNumbers if x % 2]
- print oddBridgesList
- print ""
- # The sum of the even numbers of Bridges
- print "The sum of the even Bridges is: ", sum(evenBridgesList)
- # The sum of the odd numbers of the Bridges
- print "The sum of the odd Bridges is: ", sum(oddBridgesList)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement