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

challange1

# Hello World program in Python
    
def day_of_week(year, month, day):
        t = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4]
        year -= month < 3
        return (year + int(year/4) - int(year/100) + int(year/400) + t[month-1] + day) % 7

print(day_of_week(2019,04,7))

Little shop

#program Little Internet Shop

users = [
  'Anna',
  'Bob',
  'Veronika',
  'Matthew',
  'Lucas',
  'Vladimir',
  'Michael',
  'Helena',
] 

goods = [
  ['Apples', 70],
  ['Bananas', 30],
  ['Sugar', 45],
  ['Tea', 50],
  ['Coffee', 95],
]

name = input('what is your name: ')
if name in users:
print('Hello,  ' + name)

something = input('What do you want to buy: ')
if something in goods:
count = input('How many:  ')
print(price * count)
print('You want to buy  ' + str(count) + ' ' + something)
print('Anything else?')
Answer 'no' or 'yes'
if answer 'yes', start from line 26
print('It will cost you ' + str(total) + ' rouble(s)')

Execute Python Online

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

soline

import random from randint

#Variable à choisir
cote_cube=3

def position_part(x,y,z):
    
x=random(0,cote_cube)
y=random(0,cote_cube)
z=random(0,cote_cube)
modulev=(x**2+y**2+z**2)**(1/2)
print(x,y,z)
def generateOnePart():
    modulev=()**(1/2)

soline

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

soline

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

Execute Python Online

# A Python program to demonstrate working of OrderedDict 
from collections import OrderedDict 

print("This is a Dict:\n") 
d = {} 
d['1'] = 1
d['2'] = 2
d['3'] = 3
d['4'] = 4

for key, value in d.items(): 
	print(key, value) 

print("\nThis is an Ordered Dict:\n")

od = OrderedDict() 
od=d;
 
	print(od[4]) 

Execute Python Online

# Hello World program in Python
    
print "Hello World!\n"
import numpy as np
import cv2
img = cv2.imread('imam.jpg')
imgr = cv2.imread('imam.jpg',0)

kernel = np.ones((5,5),np.float32)/25
#kernel = np.ones((3,3),np.float32)*-1
dst = cv2.filter2D(img,-1,kernel)

cv2.imshow('warna',img)
cv2.imshow('kernel',dst)
cv2.imshow('gray ya',imgr)
k = cv2.waitKey(0)
if k == 27: # wait for ESC key to exit
    cv2.destroyAllWindows()
elif k == ord('s'): # wait for 's' key to save and exit
    cv2.imwrite('imam.jpg',img)
    cv2.destroyAllWindows()

Execute Python Online

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

Execute Python Online

# Hello World program in Python
print ("\tThe Wolf and The Lamb\n")
print ("\tA stray Lamb stood drinking early one morning on the bank of a woodland stream.\n That very same morning a hungry Wolf came by farther up the stream, hunting for something to eat.\n He soon got his eyes on the Lamb. As a rule Mr. Wolf snapped up such delicious morsels without making any bones about it,\n but this Lamb looked so very helpless and innocent that the Wolf felt he ought to have some kind of an excuse for taking its life.\n")
print ("\tHow dare you paddle around in my stream and stir up all the mud! he shouted fiercely.\n You deserve to be punished severely for your rashness!\n")
print ("\tBut, your highness, replied the trembling Lamb, do not be angry!\n I cannot possibly muddy the water you are drinking up there. Remember, you are upstream and I am downstream.\n")
print ("You do muddy it! retorted the Wolf savagely.\n And besides, I have heard that you told lies about me last year!\n")
print ("How could I have done so? pleaded the Lamb.\n I wasn't born until this year.\n")
print ("If it wasn't you, it was your brother!\n")
print ("I have no brothers.\n")
print ("Well, then, snarled the Wolf, It was someone in your family anyway. But no matter who it was,\n I do not intend to be talked out of my breakfast.\n")
print ("And without more words the Wolf seized the poor Lamb and carried her off to the forest.\n")
print ("The tyrant can always find an excuse for his tyranny.\n")
print ("The unjust will not listen to the reasoning of the innocent.\n")

Advertisements
Loading...

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