Introduction to programming- syntax from chapter 3

0.0(0)
studied byStudied by 0 people
full-widthCall with Kai
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/3

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

4 Terms

1
New cards

Numeric Data Types

  • Whole numbers use the int type (e.g., 3, 42)

  • Decimal numbers use the float type (e.g., 3.14, 0.01)

  • Use type() to check a value’s data type

2
New cards

Type Conversion

  • Mixing int and float results in a float

  • Use int() to truncate a float (not round)

  • Use round() to round a float to the nearest whole number or to a specified number of decimal places

3
New cards

String and Numeric Conversion

  • Convert strings to numbers: int("32"), float("32.0")

  • Convert numbers to strings: str(10), str(10.0)

4
New cards

Math Library Usage

  • Import with import math

  • Access functions like math.sqrt(x), math.sin(x), math.log(x)

  • Constants like math.pi and math.e are available