Pythonの7日間-導入
私に好奇心を生み出すための「データサイエンス」という言葉.私はインターネットの検索に興味がある.これは、より多くの興奮を作成し、トピックを続行します.Pythonは、最も人気のある言語の一つを学ぶことにします.それは素晴らしいでしょう、そして、私はPythonコードの可能性を調査すると信じています.Pythonはデータサイエンスや機械学習などで広く知られています.
どのように、私はPythonを学びますか?私は、固体パイソン財団の上でより多くのロードマップを見ます.それで、私は7日間のパイソン財団を学ぶことに決めました.
以下はPythonの基礎のリストです.
Python言語のロードマップ. Python基礎→ 基礎、基本的な構文は、開発者のためのパッケージの設定は、対応するプロジェクトには、いくつかの基本的なコーディングの練習を少しドキュメントを知っている.基礎実習Edabit.com " Pythonのパラダイム→ オブジェクト指向と関数型プログラミング手法 Pythonデコレータ、エラー処理、モジュールジェネレータ、デバッグ. ファイルI/O、正規表現、テスト、スクリプトはPythonコードで使用します. 最後にいくつかの余分なスキルが基本として知られている→ データ掻き取り、サーバーセットアップ、機械学習 毎日の進捗状況を文書化すると、将来の参照用のリファレンスジャーナルを構築するのに役立ちます.私は、同様に言語を学ぶことを探している誰にでも、この役に立つ資源を望みます.
日1紹介
Pythonは高度に解釈された言語であり、Guido van Rossum , そして1991年にリリースされました.C言語で書かれました.
どのようにPythonの作品と私はなぜ選択?
Pythonは最も人気があり、そのプログラミング言語が大好きで、Pythonコードが他のソフトウェアによって機械可読コード(バイトコード)に変換され、Pythonの仮想マシンを使用する(バイトコードを操作するために)解釈されたことを意味する言語を解釈しました.
様々なPythonインタプリタがあります.
Cython → C言語で書かれています.
Jython → Javaプラットフォームで実行します.
Pypy → これはR - Python (制限されたPython )で書かれています.cythonより速い.
IronPython → 狙う.ネットフレームワーク. 解釈される各々は、それ自身の長所と短所を持ちます.
初心者になる
プログラミングを始めるためのプログラミング言語をシンプルにするために、いくつかの基本的な“Hello World”で学ぶことを楽しみました.まず始めに.
私は、驚くべきオンラインプラットホームを使いましたrepl.it コードを始めるか、Python構文でプロジェクトを起動するのを開始するには
変数 データ型 関数 ベストプラクティス 今日私はいくつかの基本的なPythonの用語の構文、そのデータ型といくつかの関数をよく知られているプログラミング用語を理解して過ごした.
変数
変数ストア値.Pythonでは、変数名の変更を以下に示します:
変数は文字(好ましくは小さなケース)アンダースコアで始まるべきです、そして、数字に続くことができます.
従来のように、書き込み変数はアンダースコア内の複数の単語を使用します
データ型
簡単な言葉では値を表現する方法です.Pythonでは、基本的なデータ型があります. int→ 全体を表す フロート→浮動小数点数を表す ブール→ Boolean式を表すには、trueまたはfalseです. str→ 文字列を表す 複合体→ 複素値を表すために リスト タプル セット 判決 なし→ 値の不在を表す 今日はPythonのデータ型を理解するのに時間を費やします.
数
数値型の3種類があります. int (整数を表す) 浮動小数点数を表す 複素数(複素値を表すために3 + 5 j) The
数学関数
Pythonは独自の組み込み関数を持っています.私たちはケース内の様々な数学演算子を計算することができます数学関数.
Math Functions and Constant - Pythonドキュメントには、数学関数と定数
これらのMath Moduleは説明をもって機能します.
List of some Functions in Python Math Module
弦
Pythonの文字列は文字列です.
文字列連結
演算子を使用して文字列を連結できます.それは単にストリングに結合するか、「連結します」.
型変換
Pythonが異なる型で操作を実行するとエラーがスローされます
最初のもの
第二の
フォーマット文字列
string formatは、出力文字列の内容を動的に更新することで文字列を整形する方法です.最初のアイデアは文字列の連結を適用することです
文字列インデックス
Pythonの文字列は単純に文字のコレクションです.それで、我々はそれで多くのクールなトリックをすることができます.我々は文字列の文字にアクセスすることができます、サブストリングを選択し、文字列を反転し、はるかに簡単にはるかに.弦のスライスともいう.
組み込み関数とメソッド
Pythonには、文字列データ型の操作を行う組み込み関数とメソッドがあります.一般的には、関数としては、1として1というように、1つの単位である
お読みありがとうございます.
どのように、私はPythonを学びますか?私は、固体パイソン財団の上でより多くのロードマップを見ます.それで、私は7日間のパイソン財団を学ぶことに決めました.
以下はPythonの基礎のリストです.
Python言語のロードマップ.
日1紹介
Pythonは高度に解釈された言語であり、Guido van Rossum , そして1991年にリリースされました.C言語で書かれました.
どのようにPythonの作品と私はなぜ選択?
Pythonは最も人気があり、そのプログラミング言語が大好きで、Pythonコードが他のソフトウェアによって機械可読コード(バイトコード)に変換され、Pythonの仮想マシンを使用する(バイトコードを操作するために)解釈されたことを意味する言語を解釈しました.
様々なPythonインタプリタがあります.
Cython → C言語で書かれています.
Jython → Javaプラットフォームで実行します.
Pypy → これはR - Python (制限されたPython )で書かれています.cythonより速い.
IronPython → 狙う.ネットフレームワーク.
初心者になる
プログラミングを始めるためのプログラミング言語をシンプルにするために、いくつかの基本的な“Hello World”で学ぶことを楽しみました.まず始めに.
私は、驚くべきオンラインプラットホームを使いましたrepl.it コードを始めるか、Python構文でプロジェクトを起動するのを開始するには
Print("Hello, world!")# this is first-line code of python
#fethermore some code snippets
name = input("Enter the name") #Promts user input in console and store in a variable
print("welcome to world of python" + name) # prints in description with name
任意のプログラミング言語のビルディングブロックは、次のように分割できます.変数
変数ストア値.Pythonでは、変数名の変更を以下に示します:
変数は文字(好ましくは小さなケース)アンダースコアで始まるべきです、そして、数字に続くことができます.
従来のように、書き込み変数はアンダースコア内の複数の単語を使用します
first_name
Python keywords 代入変数では使用しないでください.データ型
簡単な言葉では値を表現する方法です.Pythonでは、基本的なデータ型があります.
数
数値型の3種類があります.
type
関数は、値または式の型を決定するために使用されます.num = 100 #assign value and store variable num
print(type(num)) # <class 'int'>
num1 = 9.9
print(type(num1))# <class 'float'>
num2 = num + 100
print(type(num2))# end of the result 200 i.e. <class 'int'>
num3 = num1 / 9
print(type(num3)) #end of the result num3 is 1.1 i.e. <class 'float'>
num4 = 2+4j
print(type(num4)) # <class 'complex'>
num4 = complex(3,-2)
print(num4) # 3-2j
print(type(num4)) # <class 'complex'>
In Python, variable assignment happens by just writing a name and assigning a value using the = operator.
数学関数
Pythonは独自の組み込み関数を持っています.私たちはケース内の様々な数学演算子を計算することができます数学関数.
Math Functions and Constant - Pythonドキュメントには、数学関数と定数
print(abs(-1)) # 1 to get absolute value
print(round(36.94)) # 37 round the number with depends on factor value i.e. less than or great than on 0.5
print(round(36.45)) # 36
import math # import math package
print(math.ceil(9.88)) # 10 to get lager whole number
print(math.floor(9.88)) # 9 to get smaller whole number
print(math.factorial(5)) # 120 factorial functions
The import
モジュールまたはコマンドは、Pythonライブラリからパッケージをインポートするために使用されます.先日パッケージを詳しく調べてみます.これらのMath Moduleは説明をもって機能します.
List of some Functions in Python Math Module
弦
Pythonの文字列は文字列です.
string1 = 'Whatever can you write anything within quote' # assign a string within single quotes
string2 = "Similarly, same as single quote" # assign a string within double quote
string3= '''This is a very long story or multiline statements''' # assign a paragraph within triple quotes
string4 = 'Hello! \\"kickstart as a Programmer\\"' # string with the escaped character sequence
print(type(string1)) #<class 'str'>
print(type(string2)) #<class 'str'>
文字列連結
演算子を使用して文字列を連結できます.それは単にストリングに結合するか、「連結します」.
first_name = "John"
last_name = "Mathew"
print(first_name + last_name)# JohnMathew
print(first_name +' ' + last_name) #John Mathew
型変換
Pythonが異なる型で操作を実行するとエラーがスローされます
name = "John"
age = 29
print(name + age) #TypeError: can only concatenate str (not "int") to str
#IF python concatenate, Both variable is the same data types
print(name + str(age)) # "John29"
#or
print(int(name) + age) # ValueError: invalid literal for int() with base 10: 'John'
ここでは、2種類のエラーを見ることができます.最初のもの
TypeError
→ 変数はデータ型が異なり、文字列によって異なります.第二の
ValueError
→ 変数は異なるデータ型で、よりINTに依存します.フォーマット文字列
string formatは、出力文字列の内容を動的に更新することで文字列を整形する方法です.最初のアイデアは文字列の連結を適用することです
first_name = 'John'
last_name = 'Mathew'
# String Concatenation
print('Welcome'+ first_name + " " + last_name + ' to enter python world!')
# String Formatted
print(f'Welcome {first_name} {last_name} to enter the python world!')
文字列インデックス
Pythonの文字列は単純に文字のコレクションです.それで、我々はそれで多くのクールなトリックをすることができます.我々は文字列の文字にアクセスすることができます、サブストリングを選択し、文字列を反転し、はるかに簡単にはるかに.弦のスライスともいう.
string = "Welcome to Python World"
first_letter = string[0] # indexing start with 0
last_letter = string[-1]
print(first_letter) # W
print(last_letter) # d
#string manipulating of the indexes [start:stop:step-over]
range_1 = string[0:2] # here it starts from index 0 and ends at index 1
range_2 = string[0::1] # starts at 0, stops at end with step over 1
range_3 = string[::5] # starts at 0, till end with step 5
reverse_string = string[::-1] # starts from end and reverses the string
print(range_1) # 'We'
print(range_2) # "Welcome to Python World"
print(range_3) # 'Wm or'
print(reverse_string)# 'dlroW nohtyP ot emocleW'
組み込み関数とメソッド
Pythonには、文字列データ型の操作を行う組み込み関数とメソッドがあります.一般的には、関数としては、1として1というように、1つの単位である
print()
畝round()
一方、メソッドは単にオブジェクトの一部であり、単に.
演算子.quote = 'java was popular language'
print(len(quote)) # 21 (len calculates total no of characters)
new_quote = quote.replace('java', 'python')
print(new_quote) # python was popular language
capitalize = new_quote.capitalize()
print(capitalize) # Python was popular language
upper_case = new_quote.upper()
print(upper_case) # PYTHON WAS POPULAR LANGUAGE
print(quote) # java was popular language (Note: Strings are immutable!)
それは今日のすべてです!しかし、私はさらにデータ型を学ぶことに興味がありますが、私はより多くのPythonコードを練習します.練習が私のコーディング技術をよく改善するので.Boolean型とリスト型の他のデータ型と組み込みメソッドと関数を理解し続けるでしょう.次の日にかなり興奮.お読みありがとうございます.
Reference
この問題について(Pythonの7日間-導入), 我々は、より多くの情報をここで見つけました https://dev.to/pandiyan/7-days-of-python-introduction-1bd0テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol