CS 2000 - Fall 2025.


[Home]

Welcome to CS 2000! 9/29/2025

Video of the Day

Socratica Python videos:

Logical problem of the day

What day of the week does NOT end in the letter Y? It's not "tomorrow". (My daughter Alexandra solved this problem when she was three.)

https://pollev.com/slade You may also download the app to your phone. Use the "slade" poll id.

Canvas Quiz of the Day (need daily password)

Most days, there will be a simple canvas quiz related to the lecture. You need a password to activate the quiz, which I will provide in class. These quizzes will count toward your class participation grade. The quiz is available only during class. Note: each quiz is now worth 5 points.

Click for today's quiz.

Lecture 9: UNIX / Python.

Administrivia

  • I have office hours Wednesdays from 4-6 pm, on zoom, id 459 434 2854.

  • I will be available for lunch on Mondays at 1 pm in Morse.

  • ULA office hours are found at Ed Discussions on Canvas.

  • CS Peer Advisers. Fall 2025 Peer Advisors Office Hours Schedule.

  • Homework assignments: [Assignments]. hw3 is now available.

  • Python Tutor

    Announcements

  • Every Law Firm Should Build Their Own AI, Yale Professor Says, Bloomberg News.

  • Yale Information Society Project See this week's events. Need to register.

  • Office of Career Services STEMConnect Pop Up advising Fall schedule. Drop in to one and have your resume reviewed, hear advice about finding internships, and learn more about how to get connected to alumni for networking opportunities.

  • Master's Degree in Personalized Medicine and Applied Engineering. See flyer
    The Yale School of Engineering and the Yale School of Medicine are hosting information sessions for their innovative one-year joint master’s degree in Personalized Medicine & Applied Engineering. Please share the information below to your students, advising programs, and student organizations.

    This interdisciplinary program equips students with cutting edge skills at the intersection of medicine, engineering, and computer science. Participants gain hands-on experience designing 3D solutions for personalized healthcare using technologies such as 3D imaging and printing, artificial intelligence and machine learning, robotics and computer-assisted navigation, and augmented and virtual reality (AR/VR). Graduates will be prepared to develop customized medical interventions that enhance patient outcomes and drive innovation in clinical practice.

    Who Should Apply:

  • Pre-med and medical students, biomedical/mechanical/electrical engineering and computer science majors passionate about healthcare innovation Program Highlights:
    • Interdisciplinary Courses: Co-taught by faculty from both Yale Engineering and Yale Medicine
    • Thesis Projects: Applied research in fields such as orthopedics, cardiovascular medicine, oncology, tissue engineering, sports medicine, radiation oncology, and machine learning
    • Clinical Immersion: Shadowing opportunities across 25+ specialties, including surgery, radiology, neurology, cardiology, anesthesiology, and pediatrics
    • Customized Curriculum: Flexible course selection tailored to each student’s academic background and career goals
    More details are on our website seas.yale.edu/pmae.

    Applications Open: September 15

    Join an upcoming informational Zoom Session (registration link):

    • Tuesday, Sept. 30, 6:00 pm EDT https://yale.zoom.us/j/97584615181?from=addon
    • Friday, Oct. 24, 1:30 pm EDT https://yale.zoom.us/j/93666356156?from=addon
    • Tuesday, Oct. 28, 6:00 pm EDT https://yale.zoom.us/j/98100560693?from=addon
    • Wednesday, Nov. 19, 7:00 pm EST https://yale.zoom.us/j/94992022856?from=addon
    • Wednesday, Dec. 3, 7:00 pm EST https://yale.zoom.us/j/96348713738?from=addon

    For questions, please contact:
    Dr. Daniel Wiznia (daniel.wiznia@yale.edu) and Dr. Steven Tommasini (steven.tommasini@yale.edu).
    More information and application details can be found on our website.

  • Midterm Exam

    In 2022, the New Yorker ran the above cartoon. At first, I thought it referred to our exams.

    The midterm will be Thursday October 9 at 7pm in DL 220. It will be a 2 hour hand written exam. No computers. No notes. No books. No kidding. Students registered with Student Accessbility Services will take the exam in room ML 211, across the street.

    Here is a practice exam. (solutions). Practice UNIX script. (solutions). mt.py code for practice midterm

    Here is a great resource to practice regular expressions https://regex101.com/ Also, see www.regular-expressions.info which has a tutorial as well as useful examples, including HTML tags, email addresss, IP addresses, dates, credit cards, and lots more.

    Also, the paper Music and Computation, discussed below, is also in scope, up to but not including Music. There will be true/false questions about binary encodings of numbers, text, images, and sound. No questions about music.

    Here is the document without the music section: Binary Encoding. Try this prompt with your favorite AI bot: Using the document found at https://zoo.cs.yale.edu/classes/cs200/lectures/BinaryEncoding.pdf please generate 20 sample true or false exam questions. Note: today the bots complain that they cannot load web files. Let me know if you find a way around this. In the mean time, I sent you 100 sample T/F questions on Friday.

    Getting to know Python

  • Requests.html (jupyter) Python - Requests - a better way to process web pages, plus Beautiful Soup.

    hw2 review. - biggest file. Note from Ed Discussions:

    You may use os.stat() to get the size of a file or directory. It
    returns a tuple, the 7th element of which is size, that is,
    element[6]:
    
    bs5@giraffe:~/cs200/www/lectures/newdir$ pwd
     /home/accts/sbs5/cs200/www/lectures/newdir
     sbs5@giraffe:~/cs200/www/lectures/newdir$ ls -l
     total 0
     -rwxr--r-x 1 sbs5 faculty 6 Sep 22 15:38 goodbye
     -rw-rw-r-- 1 sbs5 cs200ta 6 Nov 1 2023 hello
     -rw-r--r-- 1 sbs5 cs200ta 12 Sep 25 08:35 high
     sbs5@giraffe:~/cs200/www/lectures/newdir$ stat high
     File: high
     Size: 12 Blocks: 0 IO Block: 65536 regular file
     Device: 0,57 Inode: 3763202446 Links: 1
     Access: (0644/-rw-r--r--) Uid: (10379474/ sbs5) Gid: (63533/ cs200ta)
     Access: 2025-09-25 08:35:15.879848000 -0400
     Modify: 2025-09-25 08:35:30.394796000 -0400
     Change: 2025-09-25 08:35:30.394796000 -0400
     Birth: -
    bs5@giraffe:~/cs200/www/lectures/newdir$ p                                     
    Python 3.12.3 (main, Aug 14 2025, 17:47:21) [GCC 13.3.0] on linux               
    Type "help", "copyright", "credits" or "license" for more information.          
    >>> import os                                                                   
    >>> os.listdir()                                                                
    ['hello', 'goodbye', 'high']                                                    
    >>> os.stat('high')                                                             
    os.stat_result(st_mode=33188, st_ino=3763202446, st_dev=57,
    st_nlink=1, st_uid=\ 10379474, st_gid=63533, st_size=12,
    st_atime=1758803715, st_mtime=1758803730, s\ t_ctime=1758803730)
    >>> os.stat('high')[6]                                                          
    12                      
      
    Here is how I originally solved the problem. This is the current staff solution. Don't do this, but figure out how it works.
    def biggest_file(dir):
      tempfile = '/tmp/biggest'
      cmd = 'ls -l ' + dir + " > " + tempfile
      # print( "Command to run:", cmd )
      status = os.system(cmd)
      # print ("status: " + str(status))
      if status:
          # print ( "Error in executing command: " + cmd)
          return '*** error reading ' + dir
      size = 0
      name = ''
      for line in open(tempfile, 'r'):
          fields = line.split()
          # print (fields)
          if len(fields) == 9:
              s = fields[4]
              n = fields[-1]
              if int(s) > size:
                  size = int(s)
                  name = n
      os.remove(tempfile)
      return ( name ) 
    

    Everything is bits!

    See Music and Computation.

    Object Oriented Programming

    Oop.html (jupyter) object oriented programming.

    F String Formatting

    Getting to know UNIX

    UNIX Introduction Principle 2.
    [Home]