Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

dice

import random
print random.randint(1,6)

numbern1=("loser")
number2=("Winner")
number3=("Winner")
number4=("Winner")
number5=("Winner")
number6=("BONUS WINNER")

if number1 

Dice roll program

import random
#variable list

win = ("You win!")
lose = ("You lose!")
bonus = ("Bonus win!")
minroll = (1)
maxroll = (6)
diceroll = random.randint(minroll,maxroll)

#main program
print diceroll
if diceroll == minroll:
    print lose
elif diceroll == maxroll:
    print bonus
else:
    print win

sammys dice program

import random
#varible list
diceroll = random.randint(1,7)
win = ("You win")
lose = ("You lose")
bonus = ("You bouns win")
minroll = 1
maxroll = 6
diceroll = random.randint(minroll,maxroll)

#main program
print diceroll
if diceroll == minroll:
    print lose
elif diceroll == maxroll:
    print bonus
else:
    print win

Execute Python Online54tewrtfyu765redfgyt65rfgh

person = input('Lucas')
print ("hello person")

Execute Python Online

#noa yakobi
num1 = 100
print (num1 / 20, num1 + 100 , num1 - 25 , num1 * 2 , num1 ** 2) 

Execute Python Online

# Hello World program in Python
    
print "Hello World!\n"

temp.py

# Hello World program in Python
    
print "Hello World!\n"

Execute Python Online

print("Mitu kypsist on tordi laius? ")
tordi_laius = int(input())
print("Mitu kypsist on tordi pikkus? ")
tordi_pikkus = int(input())
print("Mitme kihilist torti sa teha soovid? ")
tordi_kihte = int(input())
print("Mitu kypsist on yhes pakis? ")
kypsiseid_pakis = int(input())
kypsiseid = tordi_laius * tordi_pikkus * tordi_kihte
pakke = kypsiseid / kypsiseid_pakis
print ("Tordi tegemiseks tuleb osta + pakke + kypsisepakki") 

Execute Python Online

# Hello World program in Python
    
vals = [7,4,10,3,5,6,12,15]

tree = []
for i in range (0,len(vals)):
    tree.append([vals[i],None, None, None])

#sort out the links
for i in range(1,len(tree)):
    #pointer position and previous
    ptr = 1
    pos = 0
    pre = 0
    while ptr != None:
        if tree[i][0] < tree[pos][0]:
            #go left
            ptr = tree[pos][1]
            tree[i][3]=pre
            pre=i
        else:
            #go right
            ptr = tree[pos][2]
            tree[i][3]=pre
            pre=i

        if ptr != None:
            pos = ptr

    if tree[i][0] < tree[pos][0]:
        # go left
        tree[pos][1] = i
    else:
        # go right
        tree[pos][2] = i

print(tree)

Execute Python Online

# Hello World program in Python
    
vals = [7,4,10,3,5,6,12,15]

tree = []
for i in range (0,len(vals)):
    tree.append([vals[i],None, None, None])

#sort out the links
for i in range(1,len(tree)):
    #pointer position and previous
    ptr = 1
    pos = 0
    pre = 0
    while ptr != None:
        if tree[i][0] < tree[pos][0]:
            #go left
            ptr = tree[pos][1]
        else:
            #go right
            ptr = tree[pos][2]

        if ptr != None:
            pos = ptr

    if tree[i][0] < tree[pos][0]:
        # go left
        tree[pos][1] = i
    else:
        # go right
        tree[pos][2] = i

print(tree)

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.