作品集

ホームに戻る

ここに私たちが作った Pythonなどのコードを張り付けていきます。

もちろん、オールフリーです。

使うときはScratchのコメントで。

コピペするときは、インデントに注意してください!

もし、こいつらをコピペするときは、改造して遊んでみてください!

きっと楽しいと思いますよ!

もしよかったら改造したコードを教えてください!

凡例 p→Python

   b→BASIC

ライブラリー集はここに置いときます

p1,カレンダーを出力(1か月) 開発環境Python3.7 by choriss55

import calendar

year = int(input("年は"))
month = int(input("月は"))

print (calendar.month(year,month))

p2,カレンダーを出力(1年) 開発環境Python3.7 by choriss55

import calendar

year = int(input("年は"))

for month in range (12):
    print (calendar.month(year,month+1))

p3,正方形を描写 開発環境Python3.7 by choriss55

from turtle import *
clear()
pendown()
for i in range(4):
    forward(100)
    left(90)
penup()

p4,実数^2~100 開発環境Python3.7 by choriss55

b = input ("実数を入力")
a = float(b)
for i in range (2,100):
    ax = a**i
    print (str(a)+"^"+str(i)+"="+str(ax))
print ("end")

p5,税込み表示 開発環境Python3.7 by choriss55

x = input ("軽減税率対象価格")
xx = input ("通常税率対象価格")
z = int (x)
zz = int (xx)
z108p_no_int = z*1.08
z108p = int (z108p_no_int)
zz110p_no_int = zz*1.1
zz110p = int (zz110p_no_int)
print ("軽_税抜き" + str(z) +"円→税込み" + str(z108p) + "円")
print ("常_税抜き" + str(zz) +"円→税込み" + str(zz110p) + "円")
print ("合計"+str(z108p + zz110p)+"円")

p6,現在時刻を表示(開始直後の時刻) 開発環境Python3.7 by choriss55

from datetime import *

dt = datetime.now()
res1 = str(dt.year) + "年" + str(dt.month) + "月" + str(dt.day) + "日"
res2 = str(dt.hour) + "時" + str(dt.minute) + "分" + str(dt.second) + "秒" + str(dt.microsecond)
print (res1)
print (res2)

p7,現在時刻を無限に 開発環境Python3.7 by choriss55

from datetime import *

while True:
dt = datetime.now()
res1 = str(dt.year) + "年" + str(dt.month) + "月" + str(dt.day) + "日"
res2 = str(dt.hour) + "時" + str(dt.minute) + "分" + str(dt.second) + "秒" + str(dt.microsecond)
print (res1+res2)

※注意※

終わりたいときは、CTRLとCを同時に押してください。

p8,ランダム選択 開発環境Python3.7 by choriss55

import random

def random_choice(com):
   data = com.split()
   choice = random.choice(data)
   ans = '「{}」が選ばれました。'.format(choice)
   print (ans)

X = input ("選ぶものを1つずつ半角スペースで区切って入力してください")
random_choice(X)

p9,円描写

from turtle import *

def cicle(size):
    clear()
    pendown()
    for i in range(360):
        forward(size/100)
        left(1)
    penup()

cicle(int(input('size')))

b1,フィボナッチ数列 開発環境BASIC(PCG850VS) by choriss55

4 B=1:PRINT B
10 WAIT
20 A=1
30 B=1
40 C=2
50 PRINT A
60 C=A+B
70 B=A
80 A=C
90 IF A>9.99999999E98 THEN END
100 GOTO 50

inserted by FC2 system