<jupyter_start><jupyter_text>1) Verify if a value is an integer<jupyter_code>a = 2
type(a)<jupyter_output><empty_output><jupyter_text>2)Verify if a value is even<jupyter_code>a = 10
a%2 == 0<jupyter_output><empty_output><jupyter_text>3) Insert two numbers. Is the first is bigger than the second?<jupyter_code>a = 3
b = 4
a>b<jupyter_output><empty_output><jupyter_text>4) Verify if one value is multiple of another<jupyter_code>a = 3
b = 8
a%b == 0 or b%a == 0<jupyter_output><empty_output><jupyter_text>5) Calculate the interest earn by an investor that invested an amount of capital of 200 during three years with aninterest rate of 3%.(I= P*R*T)<jupyter_code>P = 200
R = float(3/100)
T = 3
Interest = P*R*T
Interest<jupyter_output><empty_output><jupyter_text>6) Capital that an investor obtained after investing an amount of capital of 200 during three years with an interestrate of 3%. (Compound interest)<jupyter_code>#AV(Accumulated value) = P*(1+r)^T
AV = P*(1+ R)**T
AV<jupyter_output><empty_output><jupyter_text>7) Calculate your BMI (Body Mass Index) BMI = mass(kg)/Height^2(m)<jupyter_code>mass = 80
height = 1.78
bmi = mass/(height)**2
bmi<jupyter_output><empty_output><jupyter_text>8) Calculate the Golden ration:<jupyter_code>gr = (1+5**0.5)/2 #without using libraries
gr
import math # with libraries
gr = (1+math.sqrt(5))/2
gr<jupyter_output><empty_output><jupyter_text>9) Calculate the NPV (Net present value) of an investment, considering an initial investment of 10000, the following Cashflows 2000,3000, 4000, 4000 and 5000 and a discount rate of 10%.<jupyter_code>cashflow = [2000,3000,4000,4000,5000]
r = 0.1

def npv(cashflow,r):
    f = 0
    i = 0
    pv = cashflow[f]/((1+r)** i)
    
    while i < len(cashflow):
        f +=1
        i +=1
        return pv
    
print(npv(cashflow,r))<jupyter_output>2000.0<jupyter_text>10) Ask the user to insert name and age. Calculate the birth year. Print a result saying the 'this person was born in.'1. Solve the problem without using modules and libraries2. Solve the problem using the date library from module datetime, as follow:<jupyter_code>name = input("Please input your name ")
age = int(input("Please enter your age "))
birth_year = 2020 - age
print("this person was born in", birth_year)
from datetime import date
today = date.today()

name = input("Please input your name ")
age = int(input("Please enter your age "))
birth_year = today.year - age
print("this person was born in", birth_year)<jupyter_output>Please input your name Reevu
Please enter your age 29
this person was born in 1991<jupyter_text>11) Ask the user to insert forenames, surnames. Create a new variable (name) with your complete name.<jupyter_code>#Create the following variables:
#nameBig - all the characters of the name are capitalized
#nameTitle - only the first character of each name (word) is capitalized
#nameSmall - all the characters of the name are lowercase.
#nameCapitalized - only the first character of the first name is capitalized
forename = input("Please enter your first name ")
surname = input("please enter your last name ")
print(forename+' '+surname)
name =(forename +' '+surname)
nameBig = name.upper()
print(nameBig)
nameTitle = name.title()
print(nameTitle)
nameSmall = forename.lower()+' '+surname.lower()
print(nameSmall)
nameCapitalized = forename.capitalize()+' '+surname.lower()
print(nameCapitalized)<jupyter_output><NAME><jupyter_text>12) Use the following method to show in which character appears the first "da"<jupyter_code>#str.find(sub,start,end)
#What happens if the content of sub is not found in str?
quote = "Notre dame is a getting a makeover"
pos = quote.find("da",2,12)
print(pos)
quote = "Notre dme is a getting a makeover"
pos = quote.find("da",2,12)
print(pos)<jupyter_output>-1
{'fraction_non_alphanumeric': 0.10966887417218543, 'fraction_numerical': 0.03629139072847682, 'mean_word_length': 5.521588946459413, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 47, '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': '12', 'dir': 'jupyter-structured-clean-dedup', 'id': '256168', 'license': 'MIT', 'n_tokens_mistral': 1393, 'n_tokens_neox': 1265, 'n_words': 428, 'path': 'lab01.ipynb', 'repo_name': 'reevutrprog/TRPROG', 'size': '3783'}