Advertisement
joseleeph

Untitled

Mar 31st, 2021
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #roster.py
  2. import cs50
  3. from sys import exit, argv
  4.  
  5. if len(argv) != 2:
  6. print("invalid number of command line arguments")
  7. exit(1)
  8. studb = cs50.SQL("sqlite:///students.db")
  9. students = studb.execute("SELECT first, middle, last, birth, house FROM students WHERE house = ?", argv[1])
  10. for wiz in students:
  11. if wiz["middle"] == '':
  12. print(wiz["first"], end = " ")
  13. print(wiz["last"], end = " ")
  14. print("born " + str(wiz["birth"]))
  15. #print(wiz[first], wiz[last], house)
  16. else:
  17. print(wiz["first"], end = " ")
  18. print(wiz["middle"], end = " ")
  19. print(wiz["last"], end = " ")
  20. print("born " + str(wiz["birth"]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement