CMPT 165 Lecture : CMPT165-Variables.docx

46 views5 pages

Document Summary

Sum:potash: if we want python to treat x and y as numbers, we will have to tell it to do this, to treat x and y as numbers, we will have to convert them from strings to numbers. That is, we have to change their data type: all variables have a specific data type, the data type of a variable lets python know how to treat the variable. Adding two strings together will attach them together, whereas adding two numbers together will mathematically add them: string (str) Stores a whole number (no decimal point: floating point (float) Stores a number with a decimal point: boolean (bool) Stores either true or false: for the calculator, x and y are numbers, so we could store them in either integers or floats. Sum:5. 0: our corrected calculator could still produce a runtime error for example, if the user types in a word instead of a number.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions