CPSC 231 Chapter Notes - Chapter 2: Natural Number

76 views2 pages

Document Summary

A value is one of the fundamental thing (i. e. word or number) that a program manipulates. Type() gives you the type of the value. Anything within the are strings (even if it"s a number) Whole number types are int and decimals types are float. In order to have several lines, it is put in the beginning and in the end. They can also contain single and double quotes. Int() turns decimals into whole numbers by discarding the decimals (i. e. 3. 999=3) and it cannot print strings. Float() turns integers or legal string integers into a float (i. e. 1 =1. 0) Str() turns its argument into a string. Assignment token (=) creates variables and gives them values (i. e. a(variable) =(token) 12(value)) (read as a is assigned to 12) = is not the same as == (equal) Variable names can never contain spaces (i. e. age_women) Keywords such as elif, in, true cannot be used as variables.

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