<jupyter_start><jupyter_text>Python 101  data types- integers- floats- strings- boolians- lists- tuples- dictionaries<jupyter_code>ali_list = [20, 'Ali', 'Male']
ali_dictionary = {'age': 20, 'name': 'Ali', 'gender': 'Male'}
ali_dictionary2 = ali_dictionary.copy()
ali_dictionary2
ali_dictionary2['age'] = 25
ali_dictionary2['age']
ali_dictionary['age']
a = 12
b = 4.<jupyter_output><empty_output><jupyter_text>loops- for loop- while loop<jupyter_code>for i in range(0,200,3):
    print(i)
    if ( i > 20):
       break
x = 0
while( x < 20 ):
    print(x)
    x = x + 1
    


    
range(0,20,3)<jupyter_output><empty_output><jupyter_text>conditions<jupyter_code>x = 1.2
if(x == 1):
    print('hello')
elif(x == 2):
    print('bye')
else:
    print('bye-bye')<jupyter_output>bye-bye<jupyter_text>Odd Or EvenAsk the user for a number. Depending on whether the number is even or odd, print out an appropriate message to the user. Hint: how does an even / odd number react differently when divided by 2?  DivisorsCreate a program that asks the user for a number and then prints out a list of all the divisors of that number. (If you don’t know what a divisor is, it is a number that divides evenly into another number. For example, 13 is a divisor of 26 because 26 / 13 has no remainder.)  List ComprehensionsLet’s say I give you a list saved in a variable: a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]. Write one line of Python that takes this list a and makes a new list that has only the even elements of this list in it.  List Less Than Tenwrite a program that prints out all the elements of the list that are less than 5.<jupyter_code>rands = np.random.randint(0,100,30)
rands
[i for i in rands if (i <= 20)]
x = input("Please enter a number: ")
x = float(x)

if (x % 2 == 0):
    print('your number is even')
else:
    print('your number is odd')

import numpy as np
list_ = np.random.randint(10,100,10000)
list_even = []
list_odd = []
for i in list_:
    if(i % 2 == 0):
        list_even.append(i)
    else:
        list_odd.append(i)
len(list_even), len(list_odd)
np.savetxt('even_list.txt', list_even)
list_2 = np.loadtxt('even_list.txt')<jupyter_output><empty_output><jupyter_text>1, 2, 3, 4, 5<jupyter_code>a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
evens = [i for i in a if i % 2 == 0]
! cat even_list.txt
np.savetxt(header='even list')
np.savetxt?
st = 'hello world'
st_list = list(st)
st_list[::-1]
import numpy as np
list_ = np.random.randint(10,100,10000)
list_1 = [x for x in list_ if x<50]
data = np.loadtxt('data/test.txt')
x = data[:, 0]
y = data[:, 1]
x,y,z,a = np.loadtxt('data/test.txt', unpack=True)
x
! cat data/test.txt
import pandas as pd
data_name = ['t','x', 'y', 'phase']
df = pd.read_csv('data/test.txt', sep='\t', names=data_name, index_col=0)
df['sum'] = df['x'] + df['y']
plt.figure(figsize=(15,10))
plt.subplot(221)
plt.plot(df.index, df['x'], label = 'x')
plt.legend()
plt.xlabel('time')
plt.subplot(222)
plt.plot(df.index, df['y'], label = 'y')
plt.legend()
plt.subplot(224)
plt.plot(df.index, df['phase'], label = 'phase')
plt.legend()
ln_x = np.log(df['x'])
plt.figure(figsize=(10,5))
plt.plot(df.index, df['x'], 'r--', label= 'x')
plt.legend(loc = 2)
plt.xlabel('time')
plt.ylabel('x')
plt.title('population')
plt.savefig('images/x_pop,png' , dpi = 300)
x_ = np.random.normal(0, 1, 100)
y_ = np.random.normal(1, 2, 100)
plt.plot(x_)
plt.plot(y_)
! ls images/
plt.plot?<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15987186953989516, 'fraction_numerical': 0.046010483401281305, 'mean_word_length': 4.375586854460094, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '547858', 'license': 'MIT', 'n_tokens_mistral': 1491, 'n_tokens_neox': 1315, 'n_words': 406, 'path': 'numericalPython/Python101.ipynb', 'repo_name': 'nosratullah/econophysics', 'size': '3434'}