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

TestLuci

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

asdf

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

vivek

friends=['john','pat','gary','vivek']
for i, name i
enumerate (friends):
    print "iteration
    {iteration} is
    {name}".format (iteration=i,
    name=name)

diceroll

import random
#variable list
win = ("you win")
lose = ("you lose")
bonus =("bonus win")
minroll = 1
maxroll = 10
diceroll = random.randint(minroll,maxroll)

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

Diceroll project

import random
#variable list
diceroll= random.randint(1,6)
win=("You Win!")
lose= ("You Lose!")
bonus= ("Bonus Win!")
minroll = 1
maxroll = 6

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

תרגיל 1

print "\nnumber 1:"
print "\n"
num1 = 100

num1 = num1 / 20
num1 = num1 + 100
num1 = num1 - 25
num1 = num1 * 2
num1 = num1 ** 2

print num1

print "\nnumber 2:"

num2 = 10
print "\n"
print '%s \n%s' % (num1, num2) 
print '\n%s %s' % (num1, num2) 
print "\n" 
print num1 + num2
print '\n' 
print num1 * num2

print "\nnumber 3:"

print "\n" 
print num1 + num2, "is the summary of num1 and num2"
print '\n' 
print num1 * num2, "is the product of num1 and num2"




    









Python Help v1

# to write use print
name = "Drew" # assinging variables
number = (5 + 20) # MATH

print name
print number

a=b=c=4.7 # multiple variables

print a
print b
print c
print "1"

d,e,f = 1,"poo", 7
print f
print d
print e

#""\n\n" to skip
print "\n\nskip"

#var = 10
#del var
#print var #(^ makes error)

fork = "SpoonFork"
print "\n"
print fork
print fork[0:5] 
print fork *8
print "\n"
ist = [123, "wert"]
lis = [12,"13k", 2345]
print lis
print ist + lis

dict = {}
dict['one'] = "This is one"
dict[2]     = "This is two"

tinydict = {'name': 'john','code':6734, 'dept': 'sales'}


print dict['one']       # Prints value for 'one' key
print dict[2]           # Prints value for 2 key
print tinydict          # Prints complete dictionary
print tinydict.keys()   # Prints all the keys
print tinydict.values() # Prints all the values

0

Execute Python Online

# Hello World program in Python
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(0, 5, 0.1)
y = np.sin(x)
plt.plot(x, y)
plt.show()







##import numpy as np 
#import matplotlib.pyplot as plt
#a = np.random.randint(1,100, 5)
#b = np.random.randint(1, 100, 5)
#print a
#print "\n"
#print b
#print "\n"
#3plt.plot(a,b)

Execute Python Online

# Hello World program in Python
with open("copy.py","w") as fp1:  
 with open("main.py","r") as fp:
   fp1.write(fp.read())

danielleweiss

# danielle weiss first assignment
num1 = 100 #1
print num1/20   
print num1+100
print num1-25 
print num1*2
print num1*num1
num2 = 10 #2
print num1,"this is num1" 
print num2,"this is num2"
print num1,num2
print "this is the summary", num1+num2 #3
print  "this is the multiply", num1*num2 

num1 = 3
num2 = 7
print num1,"+",num2,"=",num1+num2

Advertisements
Loading...

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