Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pre-define the number of presidents to request the user to input in the range
- number_of_additional_presidents = 4
- presidents = ["Clinton", "Bush", "Obama", "Trump"]
- def main():
- #initiate the assignment with a list of our 4 most recent presidents
- #request user to insert the name of 4 additional presidents to be added to our table
- for yourpresidents in range(number_of_additional_presidents):
- s = (input('Enter the name of another president '))
- presidents.append(s)
- #for aesthetic reasons, line breaker, aswell as a title
- print()
- print("Here is your list of presidents, sorted:")
- print()
- #sort your list of presidents and print
- def printPresidents():
- presidents.sort()
- for i in range(len(presidents)):
- print(presidents[i])
- main()
- printPresidents()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement