<jupyter_start><jupyter_text>Lab3: Data Types and Data Structures* Sutdent: <NAME>* Group: B* Date = 22/09/2020  Lab 3.2 Vowels and consonants classifier<jupyter_code>vowels = "a","e","i","o","u","A","E","I","O","U"

vowels_list_lower = []
consonant_list_lower = []
vowels_list_upper = []
consonant_list_upper = []

sentence = input("Write a sentence please:\n")

for character in sentence:
    if character in vowels:
        if character.islower() == True:
            vowels_list_lower.append(character)
        else:
            vowels_list_upper.append(character)
            
    else:
        if character.isupper() == True:
            consonant_list_upper.append(character)
        else: 
            consonant_list_lower.append(character)
print("Las vocales que ha utilizado son:\n-Las minúsciulas:{}\n-Las mayúsculas:{}\n\nY de las consonantes:\nLas minúsculas:{}\nLas mayúsculas:{}".format(vowels_list_lower,vowels_list_upper,consonant_list_lower,consonant_list_upper))<jupyter_output>Write a sentence please:
Hola QUE tal GENTE?
Las vocales que ha utilizado son:
-Las minúsciulas:['o', 'a', 'a']
-Las mayúsculas:['U', 'E', 'E', 'E']

Y de las consonantes:
Las minúsculas:['l', ' ', ' ', 't', 'l', ' ', '?']
Las mayúsculas:['H', 'Q', 'G', 'N', 'T']<jupyter_text>Lab 3.3 Matrix multiplication<jupyter_code>import numpy as np
A = np.array([[1,2,1],[3,3,4],[0,8,0]])
B = np.array([[0,0,1],[5,5,1],[2,1,1]])
C = np.array([[0,0,0],[0,0,0],[0,0,0]])

if len(A) == len(B[0]):
    for columna in range(0,len(A)):
        for fila in range(0,len(B[0])):
            for valor in range(0,len(A[0])):
                C[fila][columna] += A[fila][valor]*B[valor][columna]
else:
    print('No se pueden multiplicar estos vectores')
print(C)
if C.all() == (np.dot(A,B)).all():
    print('\nBien chaval!\n :)')<jupyter_output>[[12 11  4]
 [23 19 10]
 [40 40  8]]

Bien chaval!
 :)<jupyter_text>Lab 3.4 Hands on lists methods<jupyter_code>lista = ['25', 'Perro', '6.7']
print(lista[:0],lista[:],lista[:3])

lista.append(input('Que quieres añadir a la lista?\n'))
print(lista)
lista.extend(['leon', 'jirafa'])
print(lista)
#No se puede hacer si la toda la sita no es del mismo tipo.
lista.sort()
print(lista)
lista.reverse()
print(lista)
lista.insert(2,'zebra')
print(lista)
lista.remove('6.7')
print(lista)
lista.count('Perro')
print(lista)
lista.pop()
print(lista)
index = lista.index('zebra')
print(index)<jupyter_output>[] ['25', 'Perro', '6.7'] ['25', 'Perro', '6.7']
Que quieres añadir a la lista?
gato
['25', 'Perro', '6.7', 'gato']
['25', 'Perro', '6.7', 'gato']
['25', 'Perro', '6.7', 'gato', 'leon', 'jirafa']
['25', '6.7', 'Perro', 'gato', 'jirafa', 'leon']
['leon', 'jirafa', 'gato', 'Perro', '6.7', '25']
['leon', 'jirafa', 'zebra', 'gato', 'Perro', '6.7', '25']
['leon', 'jirafa', 'zebra', 'gato', 'Perro', '25']
['leon', 'jirafa', 'zebra', 'gato', 'Perro', '25']
['leon', 'jirafa', 'zebra', 'gato', 'Perro']
2<jupyter_text>Lab 3.5. Saving student grades with dictionaries<jupyter_code>import numpy as np

student1 = {'Name': 'Juan', 'ID':1234,'Grades':[9.3,9.7,8.5]}
student2 = {'Name': 'Esther', 'ID':4573,'Grades': [10.0,7.6,5.7]}
student3 = {'Name': 'Pedro', 'ID':1234,'Grades': [8.4,9.3,2.9]}
student_data = {}
mean_total = []

student_data = dict(student1),dict(student2),dict(student3)

for i in student_data:
    mean = np.mean(i['Grades'])
    mean_total.append(np.mean(i['Grades']))
    print('Student:',i['Name'], 'got and average:', mean)

np.mean(mean_total)<jupyter_output>Student: Juan got and average: 9.166666666666666
Student: Esther got and average: 7.766666666666667
Student: Pedro got and average: 6.866666666666667<jupyter_text>Lab 3.6. Counting letters using a dictionary<jupyter_code>sentence= 'Mississippi is the second longest river in the United States'
rivers = {}

for character in sentence:
    rivers[character] = rivers.get(character,0)+ 1
    #El hecho de poner .get(character , 0), nos dice que sio el valor es nulo se le añada el valor 0
    # FORMA LARGA:
    #if rivers.get(character)== None:
    #    rivers[character] = 0
    #else:
    #    rivers[character] += 1
print(rivers)<jupyter_output>{'M': 1, 'i': 8, 's': 8, 'p': 2, ' ': 9, 't': 6, 'h': 2, 'e': 7, 'c': 1, 'o': 2, 'n': 4, 'd': 2, 'l': 1, 'g': 1, 'r': 2, 'v': 1, 'U': 1, 'S': 1, 'a': 1}
{'fraction_non_alphanumeric': 0.21337060330771024, 'fraction_numerical': 0.05217796412764966, 'mean_word_length': 4.732977303070761, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 3, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '193735', 'license': 'MIT', 'n_tokens_mistral': 1915, 'n_tokens_neox': 1785, 'n_words': 412, 'path': 'LABS/Lab3.ipynb', 'repo_name': 'juanvecino/Python_LAB', 'size': '4298'}