Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

random picker in python

import random
#dictionary
x_dict = {30:60, 20:40,10:20}
key = random.choice(list(x_dict))
print (key)#if you want it to print 30, 20, or 10
print (x_dict[key])#if you want it to print 60, 40, or 20
print (key,"-", x_dict[key])# if you want to print 30 - 60, 20-40,or 10-20
Comment

Random Picker Python

import random

print(random.randint(15, 30)) #Prints a number from 15 to 30 after picking a random number from 15 to 30
RandomNumber = random.randint(0,100)
print(RandomNumber)
Comment

PREVIOUS NEXT
Code Example
Python :: 2 distinct numbers random number generator python 
Python :: pandas dataframe remove rows by column value 
Python :: how to print thgings in multiple linew in python 
Python :: two sum python 
Python :: pyautogui press enter 
Python :: get guild by id discord.py 
Python :: python get first n elements of dict 
Python :: python append a file and read 
Python :: get sum from x to y in python 
Python :: how to update python 
Python :: python how to split a number 
Python :: python sort two key 
Python :: create spark dataframe from pandas 
Python :: pyautogui moveTo overtime 
Python :: fibonacci number in python 
Python :: build dataframe from dictionary 
Python :: python tkinter scrollbar widget 
Python :: python file parent 
Python :: median of a list in python 
Python :: assert keyword python 
Python :: excel get unique values from column formula 
Python :: convert number from one range to another 
Python :: pyspark show all values 
Python :: input command in python shell 
Python :: import time in python 
Python :: how to make a list string in python 
Python :: python string to int 
Python :: python add up values in list 
Python :: json url to dataframe python 
Python :: pyplot width 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =