Pythonの基本チートシート!


こんにちは皆さん、私はあなたにPythonのチートシートを提供します> :)

1>パイソンとは?
Python は、1991 年 2 月 20 日に Guido Van Rossum によって作成された OOP (オブジェクト指向プログラミング) 言語です.

2> グイド・ヴァンの情報
Guido は Google で働いていましたが、DropBox の作成にも貢献しました.

3>基本機能
3.1> ハローワールド!

#this is a comment
#all you have to do for printing hello world is this:
print("Hello World!")


3.2>変数!

x = "this is a variable!"
#to print the variable do this:
print(x)


また、変数を追加することもできます!

a = 2
b = 3
#if you want you can do print(a+b)
#but to make it more comfortable you can do this:
print("2 + 3 is " a+b"!")


3.3>インプット!

input("hi! ")
print("bye")


3.4>もし

x = "hi!"
if x == "bye!": #the == is important!
   print()


3.5 (PROJECT) チャットボットを作ろう!

name = input("hello! what is your name? ")
print("nice to meet you "name)
color = input("so, what is your favor of color? ")
if color == "green":
   print("mine's too!")
print("") #for some space
print(ok bye")
print("chatbot went offline")


4>ループ
2 種類のループがあります.1 つは

for()


1つはwhileです(私のお気に入り)

while()


4.1> for() は、たとえば順番に数字を設定するために使用されます

words= ["Apple", "Banana", "Car", "Dolphin" ]
for word in words:
    print (word)


4.2> while ループは、たとえば危険なループを作成するために使用されます

#be careful this is a very dangerous program
n = 0
while n <=5:
   print("the value of n is = " , n)
   n ** 1


わかりましたので、チートシート全体を作成できませんでしたが、コメントで何が見逃したのか教えてください.今のところ、この投稿を好きでユニコーンにしてください:)