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

python

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

Game of thrones

# Hello World program in Python
    
print "Hello World!\n"
print "How are you"


str = "gods be good"

print str[2:]
print str[4:9]
print str[0:] + "!!!Hey there"

test

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

test

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

Region chooser

import random
Regions = ['Kanto', 'Johto', 'Hoenn', 'Sinnoh', 'Unova', 'Kalos', 'Alola']
Home = random.choice(Regions)
kanto= ['Pallet Town','Viridian City','Pewter City','Cerulean City', 'Vermilion City','Lavender Town','Celedon City','Fuschia City','Saffron City','Cinnabar Island']
Kanto = random.choice(kanto)
johto=['New Bark Town','Cherrygrove City','Violet City','Azalea Town', 'Goldenrod City','Ecruteak City','Olivine City','Cianwood City','Mahogany Town','Blackthorn City','Safari Zone Gate','Frontier Access']
Johto= random.choice(johto)
hoenn=['Littleroot Town', 'Oldale Town','Petalburg City','Rustboro City','Dewford Town','Slateport City','Mauville City','Verdanturf Town','Fallarbor Town','Lavaridge Town','Fortree City','Lillycove City','Mossdeep City','Sootopolis City','Pacifidlog Town','Ever Grande City']
Hoenn= random.choice(hoenn)
sinnoh=['Twinleaf Town','Sandgem Town','Jubilife City','Oreburgh City','Floaroma Town','Eterna City', 'Hearthome City','Solaceon Town','Veilstone City','Pastoria City','Celestic Town','Canalave City','Snowpoint City','Sunyshore City','Pokemon League','Fight Area','Survival Area','Resort Area']
Sinnoh=random.choice(sinnoh)
unova=['Nuvema Town','Accumula Town','Striaton City','Nacrene City','Castelia City','Nimbasa City','Driftveil City','Mistralton City','Icirrus City','Opelucid City','Pokemon League','Lacunosa Town','Undella Town','Black City','White Forest','Anville Town','Aspertia City','Floccesy Town','Virbank City','Lentimas Town','Humilau City']
Unova=random.choice(unova)
kalos=['Vanville Town', 'Ambrette Town','Anistar City','Aquacorde Town','Camphrier Town','Coumarine City','Couriway Town','Cyllage City','Dendemille Town','Geosenge Town','Kiloude City','Laverre City','Lumiose City','Santalune City','Shalour City','Snowbelle City']
Kalos=random.choice(kalos)
alola=['Iki Town','Hau oli City','Heahea City','Paniola Town','Konikoni City','Malie City','Tapu Village','Po Town','Seafolk Village','Pokemon League']
Alola=random.choice(alola)
if Home == 'Kanto' :print  Kanto,',Kanto'
if Home == 'Johto' :print  Johto,',Johto'
if Home == 'Hoenn' :print  Hoenn ,',Hoenn'
if Home == 'Sinnoh':print  Sinnoh ,',Sinnoh'
if Home == 'Unova' :print  Unova,',Unova'
if Home == 'Kalos' :print  Kalos,',Kalos' 
if Home == 'Alola' :print  Alola,',Alola'

go34

minute = 30

 minute=minute + 1
 
 second = minute *60
 
 print second;

ct_proj_1

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

print("")
print ("__________________var_________________")
print("")

integerEX = 8
longIntEx = 200000000000000000000000L
floatEX = 2.2
stringEX = "Hello"
booleanEX = True

intOne = 7
intTwo = 99
floatOne = 7.9
floatTwo = 9.8

print intTwo / intOne
print float(intTwo) / float(intOne)
print int()

#if then else

print("")
print ("__________________if then else_________________")
print("")


hours = 39
wage_per_hour = 10

if hours <= 40:
    loan = hours * wage_per_hour
else:
    loan_40 = 40 * wage_per_hour
    over_hours = hours - 40
    over_hours_loan = 2 * over_hours * wage_per_hour
    loan = loan_40 + over_hours_loan
    
    
print("the calculated loan is", loan)

#_____________________________________________
#_____________________________________________
#___________________next______________________
#_____________________________________________
#_____________________________________________

print("")
print ("__________________cls1_________________")
print("")

def main():
    print ("Visual Studio Solution Sept 2017")
    return

if __name__ == "__main__":
    main()
    
    

#_____________________________________________
#_____________________________________________
#___________________next______________________
#_____________________________________________
#_____________________________________________



print("")
print ("__________________if clause_________________")
print("")


var = 100

if( var == 100) : print "Value of expression is 100"




#part 2
#nested if statement

var = 49
if var < 200:
    print "Expression value is less than 200"
    if var == 150:
        print "Which is 150"
    elif var == 100:
            print "Which is 100"
    elif var == 50:
            print "Which is 50"
    elif var < 50:
            print "Expression value is less than 50"
    else:
        print "Could not find true expression"
    
    
print "end story"


#_____________________________________________
#_____________________________________________
#___________________next______________________
#_____________________________________________
#_____________________________________________



print("")
print ("__________________while loop________________")
print("")


count = 0
while (count < 9):
    print 'The count is: ', count
    count = count + 1
    
print 'end story 2'


#_____________________________________________
#___________________next______________________
#_____________________________________________


print("")
print ("__________________else Statment with Loops_________________")
print("")


count = 0

while count < 5:
    print count, " is thess than 5"
    count = count + 1
else:
    print count, " is not less than 5"
    
    
#_____________________________________________
#___________________next______________________
#_____________________________________________


print("")
print ("__________________else Statment with Loops_________________")
print("")


#_____________________________________________
#___________________next______________________
#_____________________________________________



print("")
print ("__________________Lists and various_________________")
print("")


x = 27
y = 49
z = .271

print int(x)
#print ceil(x)
print cmp(x,y)

List1 = [44, 88, 14]

i = List1[1]
print(i)

List1[0] = 77

i = List1[0]
print i

#list Comprehensions

a = [1, -5, 4, 2, -2, 10]
b = [2*x for x in a if x > 0]

print b

a = ["Dallas", "Los Angeles", "Toronto"]

print a[0]
print len(a[0])

#_____________________________________________
#___________________next______________________
#_____________________________________________



print("")
print ("__________________Random_________________")
print("")

import random

#choicelist [55, 127, 721]
dice = random.randrange(1,7)

print('Press enter to Roll the Dice', dice)

#_____________________________________________
#___________________next______________________
#_____________________________________________

print("")
print ("__________________Strings, Etc_________________")
print("")


#Creating Python string

#Creating String using Single Quote
Str1 = 'This is a String'
print(Str1)

#Creating a string using double quotes
Str2 = "This is another String but with double quotes"
print(Str2)

# Creating String using Multiple Single Quotes
Str3 = '''This also Work in Python'''
print(Str3)

#Creating String using Triple Quotes
#This is very useful to create multiline text
Str4 = """Learn Python Programming
            At Tutorial Gateway"""
print (Str4)

#_____________________________________________
#___________________next______________________
#_____________________________________________

print("")
print ("__________________Numpy_________________")
print("")

import numpy as np
arr = np.array([1.0, 3.7, 5.3])
print arr

#_____________________________________________
#___________________next______________________
#_____________________________________________

print("")
print ("__________________SciPy_________________")
print("")

import scipy.misc as sm
n = sm.factorial(4)

print "4! = " + str(n) 

#_____________________________________________
#___________________next______________________
#_____________________________________________

print("")
print ("__________________numpy pylab scipy_________________")
print("")

import numpy as np
#from scipy import interpolate
import pylab as py

x = np.r_[0:10:11j] # also np.linspace(0,10,11)
y = np.exp(-x/4)*x

#f = interpolate.interpld(x,y)
xnew = np.r_[0:10:100j]


print x
print y
print xnew


#_____________________________________________
#___________________next______________________
#_____________________________________________

print("")
print ("__________________matplotlib numpy matplotlib_________________")
print("")

import matplotlib.pyplot as plt
import numpy as np
from matplotlib import interactive
interactive(True)


x = np.arange(0,5,0.1)
print(x)

y = np.sin(x)
print (y)

#plt.plot(x,y)
#plt.show




#_____________________________________________
#___________________next______________________
#_____________________________________________

print("")
print ("__________________pandas_________________")
print("")

import pandas as pd

unames = ['user_id', 'gender', 'age', 'occupation', 'zip']

print unames[:3]

#_____________________________________________
#___________________next______________________
#_____________________________________________

print("")
print ("__________________list method________________")
print("")

import time

# a very large list of strings
strings = ['foo', 'foobar', 'baz', 'qux',
            'python', 'Guido Van Rossum'] * 25
print strings

y = [x for x in strings if x.startswith('foo')]

print y


#_____________________________________________
#___________________next______________________
#_____________________________________________

print("")
print ("__________________print sine wave to command line________________")
print("")


import math, time
a = 0
while 1:
    print " "*int(20+20*math.sin(a))+"|"
    time.sleep(.05)
    a+=.1
    
#_____________________________________________
#___________________next______________________
#_____________________________________________

print("")
print ("__________________two numerical loops in one________________")
print("")

#traditional

m = range(1,20)
print m
print("Senior Software Architect")









Execute Python Online

import random   
diceroll=random.randint(1,6)
print random.randint(1,6) 

hi4 = print("loser")
hi6 = print("win")
hi7 = print("win")
hi8 = print("win")
hi9 = print("win")
hi0 = print("bonus win")

if dice roll is 1:
    print hi4
    
elif dice roll is 2:
    print hi6

elif dice roll is 3: 
    print hi7

else dice roll is 4: 
    print hi8

else dice roll is 5: 
    print hi9
    
else dice roll is 6: 
    print hi0

dice program

asmhdvq

Advertisements
Loading...

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