Computer Science 1026A/B Lecture Notes - Lecture 2: Roundoff, Decimal Mark, Scientific Notation

30 views9 pages
terubarenuka and 39895 others unlocked
COMPSCI 1026A/B Full Course Notes
26
COMPSCI 1026A/B Full Course Notes
Verified Note
26 documents

Document Summary

Comments: for humans, compiler ignores comments, use at the beginning of each program to clarify details of the code, denoted by # Basic math operators: + - * / orders of operations applies, // floor division. Round down after division ( 18//4 >> answer: 4) (-1739//10 = >> answer -18: % remainder after division ( 18%4 >>> answer: 2, ** x2 ( 5**2 >>> answer: 25) N%10 9 for a positive integer, n%10 will give the last digit. N//10 1720 will give n without last digits. N% 2 1 ( if odd will give 1, if even will give 0) Assignment statement the line which assigns value to the variable (tuna=5) Data types int 6 float 12. 0, 12. 1 string non taxable". Anything in exponential notation are always a float. Error :do not use commas as a decimal separator. Error: do not use fractions; use decimal notation. Tips in naming variables: don"t use x, y etc.

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