answersLogoWhite

0

How do you make a random number using Python?

Updated: 12/16/2022
User Avatar

Sohrob1023

Lvl 1
13y ago

Best Answer

this is the code for making a random number using python:

import random

>>>random.randint (1, 10)

you can do whatever numbers you want.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you make a random number using Python?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do I make a game like king's quest in python?

Using the PyGame module.


How do you make a program in python using do while loop to display the multiplication table of number from one to ten?

a = 0while a < 10 :a += 1print (a)Write the above simple script in a text editor (I use nano). Save as loop.py in home folder. To run, open a terminal and at the prompt, write: python loop.pyResult:rodney@downstairs:~$ python loop.py12345678910


Is there such thing random numbers?

yes, because the number generated is from the computer's CPU database and is selected randomly therefore it must be a random number It depends on how the numbers are generated. If they are based on things in the environment, like noise levels, then yes. If they are solely generated by computer functions, then no, they are pseudo-random numbers, which will be random enough for most purposes.


How do you make a BINGO card using Java 3.0 that when you run again the number in the bingo card will not be seen again..it would be in random?

I don't know about Java 3.0 but with the current version of Java 5.0 The Random class could be used or the Math.random() method (which really uses the Random class). The way I would approach this after getting the random number generator down is to make a class to be the Bingo Card, perhaps implemented with an instance of a 2D Array (an Array of Arrays) to hold each number, perhaps a 2D array to hold whether each box is stamped, and a method to check whether I have a bingo. If you have questions about 2D Arrays and how to manipulate them check out the link below.


Is there any way I can make Python 3.4.3 do one thing if a number is greater than 10 and another if it is less?

As in any programming language use an "if" statement.

Related questions

Is python 2.2 a antivirus software?

Python is a programming language, it is used to make computer programs. so you could write an antivirus using python.


How do I make a game like king's quest in python?

Using the PyGame module.


How do you make a program in python using do while loop to display the multiplication table of number from one to ten?

a = 0while a < 10 :a += 1print (a)Write the above simple script in a text editor (I use nano). Save as loop.py in home folder. To run, open a terminal and at the prompt, write: python loop.pyResult:rodney@downstairs:~$ python loop.py12345678910


How do you make a video game using python and Autodesk Maya?

I wouldn't recommend using either. Maya is meant for animations, and python is very bad at 3D stuff. If you want to make a game, I would recommend Unity3D or C++, and Autodesk 3DS Max.


How do you make a translator on your computer using Python?

the easy way: you make a database, where al words is listed each tabel is one language, and then you can use python to do spell it. it will make a lot of errors, even when plurols is up for it. the hard way make a smart tabel that learns using phyton and making rules.


How do you make a app using the python programming language and not using py2app?

Py2app for the Mac, or Py2exe for Windows, create a standalone executable file from a Python program, which can run without the Python interpreter. You can always run the application within the Python interpreter. If you want to create an executable file, Python includes no built-in tools to do this; you need an application such as Py2app or Py2exe. Of course, you might search for alternative tools, that do the same thing.


Is there such thing random numbers?

yes, because the number generated is from the computer's CPU database and is selected randomly therefore it must be a random number It depends on how the numbers are generated. If they are based on things in the environment, like noise levels, then yes. If they are solely generated by computer functions, then no, they are pseudo-random numbers, which will be random enough for most purposes.


How many python make up the Monty Python comedy group?

6


How many pythons make up a Monty Python?

If you mean how many Python's were there the answer is 6.


Where do you find the chameleon cuirass in oblivion?

They can be dropped as random loot, or, you can make one using a Sigil Stone.


Did they take out Python from Busch Gardens?

Yes they took out Python from Bush Gardens. The removal of Python was necessary to make way for the park's Jungala attraction.


How can you make 25.45 using the least number of bills and coins?

How can you make $25.45 using the least number of bills and coins?