This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Human(): | |
def __init__(self, name, gender, eye_color, hair, height): | |
self.name = name | |
self.gender = gender | |
self.eye_color = eye_color | |
self.hair = hair | |
self.height = height | |
h1 = Human("saeid", "male", "brown", "black", "180") | |
print(h1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
url = "https://www.saeidmedia.ir" | |
data = requests.get(url) | |
print(data) | |
print(data.text) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
My_List = [10, 14, True, False, 2.4, "ali"] | |
for item in My_List: | |
if type(item) == int and item > 10: # for --> loop | |
print("there is a integer data type and it is bigger than 10") | |
print(item) | |
for item in My_List: | |
if type(item) == float and item > 2: | |
print(item) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
# pandas series | |
a = [1, 7, 2] | |
myvar = pd.Series(a) | |
print(myvar) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
# pandas DataFrame | |
data = { | |
"prices":[300 , 600 , 900] , | |
"duration":[10 , 20 , 30] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
xpoints = np.array([3 , 6]) | |
ypoints = np.array([7 , 12]) | |
zpoints = np.array([5 , 14]) | |
plt.plot(xpoints , ypoints , zpoints) | |
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List3 = ["amir", 3, 6, 9, True] | |
List4 = [2.2 , 3.2] | |
Number = int(input("please enter the number : ")) | |
if Number > 10: | |
List3.append(Number) | |
print(List3) | |
elif Number < 10: | |
for item in List3: | |
List3.remove(item) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Name = input("please enter your name : ") | |
print("welcome" , Name) | |
Age = int(input("please enter your Age : ")) | |
if Age > 20: | |
print("you can enter ") | |
elif Age < 20: | |
print("you cant enter") | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name = "amir saeid" | |
age = 18 | |
weight = 80.88 | |
print(weight) | |
print(age) | |
name = str(input("please enter your name : ")) | |
print("welcome" + name + "!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in range(5 , 25): | |
if i > 10 and i < 15: | |
print(i , i * 2) | |
print("done") | |
elif i > 19 and i < 21: | |
print(i , i + 2) | |
print("this") | |
else: | |
print("try again !") | |
OlderNewer