<jupyter_start><jupyter_text><jupyter_code>name = input('Name: ')
print('Hello ' + name + '!')
'Hello ' + name #variables, strings dont work without "print"
#Data Types
#int (integer) and float (floating point number)
2 + 4 #works even without "print"
print(2 + 4)
print(2 - 4)
print(2 / 4)
print(2 * 4)
print(type(2 + 4))
print(type(2 - 4))
print(type(2 / 4))
print(type(2 // 4)) #'double slash' divident
print(type(2 % 4)) #'modulo' remainder

#Functions are ACTIONS that we can perform on Data Types

#math functions; Google them to find them!
print(round(3.14)) #works without print
print(abs(-3.14))

#operator precedence
#()
#**
#* /
#+ -

#Exercises
print((5 + 4) * 10 / 2) #45.0

print(((5 + 4) * 10) / 2) #45.0

print((5 + 4) * (10 / 2)) #45.0

print(5 + (4 * 10) / 2) #25.0

print(5 + 4 * 10 // 2) #25
#int str base

print(bin(24))

str1 = '0b11000' #str1 can't be converted to an integer of base other than 2, because of the "0b" prefix, which indicates a binary number in Python. 

day = int(str1, 2)
print(day)

str2 = '11000'
date = int(str2, 2)
print(date)
date_of_birth = int(str2, 4)
print(date_of_birth)
#augmented assignment operator
basic = 24
basic += 26 #basic = basic + 26
print(basic)

subtraction = 19
subtraction -= 24 #subtraction = subtraction - 24
print(subtraction)

multiplication = 19 
multiplication *= 5 #multiplication = multiplication * 5
print(multiplication)
#strings: Data Type = str #string concatenation
house_number = '687A'
street_name = 'Block A'
town_name = 'Lake Town'
city_name = 'Kolkata'
pin_code = '700089'
address = house_number + ', ' + street_name + ', ' + town_name + ', ' + city_name + ', ' + pin_code
print(address)

#Address with input function
house_number = input('House number = ')
street_name = input('Street name = ')
town_name = input('Town = ')
city_name = input('City = ')
pin_code = input('Pincode = ')
address = house_number + ', ' + street_name + ', ' + town_name + ', ' + city_name + ', ' + pin_code
print('Address for Correspondence: ' + address)

#A string cannot be concatenated with an integer or a float or anything that is not of type str.
#str #multi line strings #type conversion #escape sequences
print(type("some 4 word string"))

#multi line strings only work with three quotation marks, not one or two.
#Moreover, within the '''...''' environment, '#' does not comment out text.
multi_line_string = '''rhythm: 
trash
smash
crash
splash'''
print(multi_line_string)

#type conversion
a = 100
b = str(100)
c = int(b)
d = 2 * c
e = b + ' ' + 'percent germ free!'
print(d)
print(e)

#Escape Sequences
print('\t Long years ago there was a town called \"It\'s Nowhere". \n The people of It\'s Nowhere had the same name, \"It\'s Nobody".' )
#formatted strings
#f-strings #Python3
name = 'Ishani'
number = 3
print(f'I am {name}. I have {number} cats.') #there mustn't be any space between (f and the string following f.

#dotformatstrings #Python2 #variations
name = 'Ishani'
number = 3
print('I am {}. I have {} cats.'. format(name, number)) #dotformat1
print('I am {0}. I have {1} cats.'.format(name, number)) #dotformat2
print('I am {1}. I have {0} cats.'.format(name, number)) #dotformat3
print('I am {}. I have {} cats.'.format(number, name)) #dotformat4
print('I am {1}. I have {0} cats.'.format(number, name)) #dotformat5
print('I am {name}. I have {number} cats.'.format(name = 'Aydin', number = 0)) #dotformat6
print('I am {}. I have {} cats.'.format('Aydin', 0)) #dotformat7
print('I am {1}. I have {0} cats.'.format('Aydin', 0)) #dotformat8
print('I am {new_name}. I have {number} cats.'.format(new_name = 'Aydin', number = 0)) #dotformat9
print('I am {}. I have {count} cats.'.format('Aydin', count = 0)) #dotformat10
#print('I am {name}. I have {number} cats.'.format()) #doesn't work! #works in f-strings! #difference between fstrings and dotformatstrings #dotformat11

#f-strings #variations
print(f'I am {number}. I have {name} cats.') #fstring2
#print(f'I am {name = 'Aydin'}. I have {number = 0} cats.') #these variations don't work in f-strings #less flexible about variable assignment?<jupyter_output>I am Ishani. I have 3 cats.
I am Ishani. I have 3 cats.
I am Ishani. I have 3 cats.
I am 3. I have Ishani cats.
I am 3. I have Ishani cats.
I am Ishani. I have 3 cats.
I am Aydin. I have 0 cats.
I am Aydin. I have 0 cats.
I am 0. I have Aydin cats.
I am Aydin. I have 0 cats.
I am Aydin. I have 0 cats.
I am 3. I have Ishani cats.
{'fraction_non_alphanumeric': 0.15396789509382772, 'fraction_numerical': 0.03753108749717386, 'mean_word_length': 4.174269005847953, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '290992', 'license': 'CC-BY-3.0', 'n_tokens_mistral': 1707, 'n_tokens_neox': 1575, 'n_words': 580, 'path': 'P3_basics.ipynb', 'repo_name': 'ishaniguha/ishaniguha.github.io', 'size': '4423'}