I&C SCI 31 Lecture Notes - Lecture 3: Hello, Goodbye, George Boole

25 views3 pages

Document Summary

In terms of cs: statements, operators, function calls, method calls. Things int : 17 float : -3. 14 str : hello , goodbye . Single-valued data: int, float, bool (boolean, from george boole), str. Collection of items of all the same type. Can be of different type but we will use of the same types. Temp = [80, 90, 92, 87] (how to declare) A student might have a name (str), id (int), gpa (float), birth year (int), and major (str). student1 = ( jones, john , 3333444, 3. 45, 1996, cs ) student2 = ( johnson, sally , 11112222, 2. 00, 1997, in4mtx ) Refer to individual items in lists or types by indexing. Print (student1, student2) would print the tuples in order. Comma is used to print things in some order. Step 1: set it up (say this once at the top of the program) from collections import namedtuple. Step 2: define what your object looks like.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents