Question

1.  When using a function in the Python standard library, do you need to import the library...

1.  When using a function in the Python standard library, do you need to import the library into your program before using the function?

2.  How does the walk of a pseudorandom sequence differ from the walk of a truly random sequence?

3.  Is the computer capable of producing a truly random walk in a reasonable amount of time?

4.  Based on your research in the standard library documentation, what is the name of the function that can be used to generate random integer values?

5.  Based on your research in the standard library documentation, what is the name of the Python library used for generating cryptographically strong random numbers? Hint, it's not in random library located in the Numeric and Mathematical Modules.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer 1

Yes, when using a function in the Python standard library, we need to import the library into our program before using the function.

For example

Code

#math library which contains various math functions like, pi,cos,sin etc.
import math
#using pi function to find area of circle of radius 7 units
r=7
print('Area is : ', math.pi*r*r)

1 #math library which contains various math functions like, pi,cos, sin etc. 2 import math 3 #using pi function to find area

Output

Output: Area is : 153.93804002589985

According to chegg guidelines, i can only answer your first question.

To get all your answers, Please upload them seperately.


answered by: ANURANJAN SARSAM
Add a comment
Answer #2

Answer 1

Yes, when using a function in the Python standard library, we need to import the library into our program before using the function.

For example

Code

#math library which contains various math functions like, pi,cos,sin etc.
import math
#using pi function to find area of circle of radius 7 units
r=7
print('Area is : ', math.pi*r*r)

1 #math library which contains various math functions like, pi,cos, sin etc. 2 import math 3 #using pi function to find area

Output

Output: Area is : 153.93804002589985

According to HomeworkLib guidelines, i can only answer your first question.

To get all your answers, Please upload them seperately.

Happy HomeworkLibing

PLEASE UPVOTE

Add a comment
Know the answer?
Add Answer to:
1.  When using a function in the Python standard library, do you need to import the library...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • You may import the following library functions in your module: from fractions import gcd from math...

    You may import the following library functions in your module: from fractions import gcd from math import log from math import floor You may also use: • the .bit_length() method to efficiently obtain the bit length of an integer, • the abs() function for computing the absolute value of an integer, • and the // operator for integer division (you should avoid using / because it does not work for very large integers). Implement the following Python functions. These functions...

  • Design a program using Python and using from flask Import flask that generates a lottery number...

    Design a program using Python and using from flask Import flask that generates a lottery number but in a website.. The program should have an Integer array with 9 elements. Write a loop that steps through the array, randomly generating a number in the range of 0 through 42 for each element. (Use the random function) Then write another loop that displays the contents of the array. Each number should be displayed as a list, the numbers should be generated...

  • Before you start For this homework, we will need to import some libraries. You need to...

    Before you start For this homework, we will need to import some libraries. You need to execute the following cell only once; you don't need to copy this in every cell you run. In [ ]: import pandas import numpy from urllib.request import urlretrieve from matplotlib import pyplot %matplotlib inline ​ #This library is needed for testing from IPython.display import set_matplotlib_close set_matplotlib_close(False) Introduction In this homework, you will work with data from the World Bank. The subject of study is...

  • Part 1: Using Idle Write a Python Script that Does the Following 1. At the top...

    Part 1: Using Idle Write a Python Script that Does the Following 1. At the top of your program, import the math library as in from math import * to make the functions in the math module available. Create a variable and assign into it a constant positive integer number of your choice. The number should be at most 10. 1 Suppose we call this variable x for this writeup document Try something like x = 4 2. Create another...

  • Python, given a code in class i just need help with the third bullet point ; using a and n (defin...

    Python, given a code in class i just need help with the third bullet point ; using a and n (defined in the second picture of python code) find the first digit for k! for k =1,...,n. you dont have to type in all this code just help me write the code in the first picture where it says: def benford(a): b = [0 for d in range(1,10)] #Do everthything in here return b 2.2 Generating data In this assignment...

  • PLE HELP ME BY PYTHON Part 1: Statistical Functions In this part of the assignment, you...

    PLE HELP ME BY PYTHON Part 1: Statistical Functions In this part of the assignment, you will write four functions. The first function calculates the reciprocal of a number, which is defined as 1/number. So, for example, the reciprocal of 8 is 1/8, or 0.125. The reciprocal of 2.5 is 1/2.5 or 0.4. You must name the function reciprocal and it takes one parameter. It returns the input parameter's reciprocal. Don't worry about what happens if someone gives a zero...

  • Use the link in the Jupyter Notebook activity to access your Python script. Once you have...

    Use the link in the Jupyter Notebook activity to access your Python script. Once you have made your calculations, complete this discussion. The script will output answers to the questions given below. You must attach your Python script output as an HTML file and respond to the questions below. In this discussion, you will apply the statistical concepts and techniques covered in this week's reading about hypothesis testing for the difference between two population proportions. In the previous week’s discussion,...

  • Python Assignment In this assignment, you will use Pandas library to perform analysis on the dataset stored in the following csv file: breast-cancer-wisconsin.csv. Please write script(s) to do the fol...

    Python Assignment In this assignment, you will use Pandas library to perform analysis on the dataset stored in the following csv file: breast-cancer-wisconsin.csv. Please write script(s) to do the following: 1. Read the csv file and covert the dataset into a DataFrame object. 2. Persist the dataset into a SQL table and a JASON file. • Write the content of the DataFrame object into an SQLite database table. This will convert the dataset into a SQL table format. You can...

  • Python 3.7 to be used. Just a simple design a program that depends on its own. You should also not need to import anythi...

    Python 3.7 to be used. Just a simple design a program that depends on its own. You should also not need to import anything. No code outside of a function! Median List Traversal and Exception Handling Create a menu-driven program that will accept a collection of non-negative integers from the keyboard, calculate the mean and median values and display those values on the screen. Your menu should have 6 options 50% below 50% above Add a number to the list/array...

  • Do in Python please provide screenshots aswell. Here are the requirements for your game: 1. The...

    Do in Python please provide screenshots aswell. Here are the requirements for your game: 1. The computer must select a word at random from the list of avail- able words that was provided in words.txt. The functions for loading the word list and selecting a random word have already been provided for you in ps3 hangman.py. 2. The game must be interactive; the flow of the game should go as follows: • At the start of the game, let the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT