what does random.random do in python code example
Example 1: random module in python
>>> random()
0.37444887175646646
>>> uniform(2.5, 10.0)
3.1800146073117523
>>> expovariate(1 / 5)
5.148957571865031
>>> randrange(10)
7
>>> randrange(0, 101, 2)
26
>>> choice(['win', 'lose', 'draw'])
'draw'
>>> deck = 'ace two three four'.split()
>>> shuffle(deck)
>>> deck
['four', 'two', 'ace', 'three']
>>> sample([10, 20, 30, 40, 50], k=4)
[40, 10, 50, 30]
Example 2: random.random in python
enota = input("V kateri enoti boš podal temperaturo? Vnesi 'C' ali 'F': ")
stopinje = int(input("Število stopinj: "))
if enota != "C" and enota != "F":
print("Vnesi ustrezno enoto.")
else:
if enota == "C":
odg = int(round((9 * stopinje) / 5 + 32))
nova_enota = "Fahrenheit"
elif enota == "F":
odg = int(round((stopinje - 32) * 5 / 9))
nova_enota = "Celzija"
print("Temperatura v stopinjah", nova_enota, "je", odg, "stopinj.")