Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simple python code #585

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions python
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import matplotlib.pyplot as plt

# Assume that first line is number of book read per week for adam
X1 = [1,2,3,4,5,6,7,8,9]
Y1 = [1,7,4,7,8,4,6,0,7]
# label name
plt.plot(X1, Y1, label = "Adam")
# Assume that second line is number of book read per week for william
X2 = [1,2,3,4,5,6,7,8,9]
Y2 = [1,4,3,2,10,0,2,4,5]
# label name
plt.plot(X2, Y2, label = "William")

# Label x
plt.xlabel('X-axis')
# Label y
plt.ylabel('Y-axis')

# title of graph
plt.title('number of book reading per week')

# show legend
plt.legend()
#generate the final graph
plt.show()


# number list
numbers = [5,3,4,2,1,0,8]

# Sorting number
numbers.sort()

print(numbers)


import pandas as pd
# assign number to a and b
data = {
'a': [4, 7, 0, 2],
'b': [9, 1, 6, 3]
}
# assign y-axis
c = pd.DataFrame(data, index=['1', '2', '3', '4'])
#show output
c