knowt logo

PYTHON CHAPTER 5  (2022-2023)

Study Guide

Chapter 5

Part 1: Evaluate:

1. round(5) = 5

2. round(5.55) = 6

3. round(7.32) = 7

4. int(7.77) = 7

5. int(8.99) = 8

6. float(55) = 55.00

7. float(1000) = 1000.00

Part 2: Questions:

  1. What is an integer division?

    1. returns the number of times a value is divided into evenly

  2. What is a mod division?

    1. returns the remainder

  3. Evaluate:

    1. 17//5 = 3

    2. 15%5 = 0

    3. 24//9 = 2

    4. 33%31 = 2

    5. 55%15 = 10

  4. What is a random number and what is the syntax needed to import it.

    1. Random numbers allow us to generate values within a particular range.

    2. from random import randrange

  5. True/False: Loops can be used with random numbers.

    1. True

  6. What is the difference between round, int function, and float?

    1. Round allows numbers to be rounded to a certain number. Below .4 then rounds down. .5 or higher it rounds up.

    2. Int - Allows to cut off the decimal portion (#.##).

    3. Float is a command that changes an integer to a decimal value.

  7. What is the syntax for round?

    1. round()

  8. What is the syntax for int function?

    1. int()

  9. What is the syntax for float?

    1. float()

  10. How do we round numbers in decimal places and what is the syntax?

    1. Process rounds the value in x to y decimal places

    2. r=round(x,y)

  11. What is the import for the math class?

    1. From math import*

  12. There are many different types of methods for the math class. What is a brief example of the syntax for each one and what do each do. (Understand their meanings)

Here are some methods

y= sqrt(x)

returns square root

y=pow(a,b)

raises a to the b power

y=isnan(x)

returns true if x is not a number and false if it is

y=radians(x)

converts degrees to radians

y=degrees(x) converts radians to degrees

Trig functions

y=sin(x)

returns the sine if x is in radians

y=cos(x)

returns the cosine if x is in radians

y=tan(x)

returns the tangent if x is in radians

y=asin(x)

returns the inverse sine if x is in radians

y=acos(x)

returns the inverse cosine if x is in radians

y=atan(x)

returns the inverse tangent if x is in radians

y=pi

returns y with the value 3.141592653589793

Questions 13-15 No Answers Needed.

  1. Understand output from Chapter 5

  2. Understand Syntax

STUDY THE KAHOOT AS WELL IT WILL HELP!

JK

PYTHON CHAPTER 5  (2022-2023)

Study Guide

Chapter 5

Part 1: Evaluate:

1. round(5) = 5

2. round(5.55) = 6

3. round(7.32) = 7

4. int(7.77) = 7

5. int(8.99) = 8

6. float(55) = 55.00

7. float(1000) = 1000.00

Part 2: Questions:

  1. What is an integer division?

    1. returns the number of times a value is divided into evenly

  2. What is a mod division?

    1. returns the remainder

  3. Evaluate:

    1. 17//5 = 3

    2. 15%5 = 0

    3. 24//9 = 2

    4. 33%31 = 2

    5. 55%15 = 10

  4. What is a random number and what is the syntax needed to import it.

    1. Random numbers allow us to generate values within a particular range.

    2. from random import randrange

  5. True/False: Loops can be used with random numbers.

    1. True

  6. What is the difference between round, int function, and float?

    1. Round allows numbers to be rounded to a certain number. Below .4 then rounds down. .5 or higher it rounds up.

    2. Int - Allows to cut off the decimal portion (#.##).

    3. Float is a command that changes an integer to a decimal value.

  7. What is the syntax for round?

    1. round()

  8. What is the syntax for int function?

    1. int()

  9. What is the syntax for float?

    1. float()

  10. How do we round numbers in decimal places and what is the syntax?

    1. Process rounds the value in x to y decimal places

    2. r=round(x,y)

  11. What is the import for the math class?

    1. From math import*

  12. There are many different types of methods for the math class. What is a brief example of the syntax for each one and what do each do. (Understand their meanings)

Here are some methods

y= sqrt(x)

returns square root

y=pow(a,b)

raises a to the b power

y=isnan(x)

returns true if x is not a number and false if it is

y=radians(x)

converts degrees to radians

y=degrees(x) converts radians to degrees

Trig functions

y=sin(x)

returns the sine if x is in radians

y=cos(x)

returns the cosine if x is in radians

y=tan(x)

returns the tangent if x is in radians

y=asin(x)

returns the inverse sine if x is in radians

y=acos(x)

returns the inverse cosine if x is in radians

y=atan(x)

returns the inverse tangent if x is in radians

y=pi

returns y with the value 3.141592653589793

Questions 13-15 No Answers Needed.

  1. Understand output from Chapter 5

  2. Understand Syntax

STUDY THE KAHOOT AS WELL IT WILL HELP!