## homework_lesson_3_17_18

# -*- coding: utf-8 -*- “”” Numeric conversions @authors: stkarlos “”” print ‘ ##### Homework #####’ print ‘ #####     Homework     #####’ print ‘ try to understand the operation of functions int(x, base) , bin(x) , oct(x) , hex(x) ‘ print ‘ #####     Goodluck     #####’ print ‘ #####     Goodluck     #####’ print print a

Posted in Uncategorized

## lesson3_17_18

# -*- coding: utf-8 -*- “”” Created on Mon Mar 12 17:32:40 2018 @author: stkarlos “”” x = raw_input(‘dose timi: ‘) y = raw_input(‘dose timi ek neou:’) print type(x),’ ‘, type(y) print x + y ######################################### print print x =

Posted in Uncategorized

## norms_Math_unsolved

function x = norms_Math(A) home if nargin == 0 A = [ 1 2 3; 4 9 6; 0 -5 120]; end [m,n] = size(A); if m > 1 & n> 1 flag = 0; fprintf(‘exoume pinaka !\n’) else flag

Posted in Uncategorized

## GaussSeidel_aa1

function x = GaussSeidel(A,b,es,maxit) % A = coefficient matrix % b = right hand side vector % es = stop criterion (default = 0.00001%) % maxit = max iterations (default = 50) if nargin<2,error(‘at least 2 input arguments required’),end if

Posted in Uncategorized

## jacobi_aa1

function [x, iflag, itnum] = Jacobi(A,b,x0,delta,max_it) % x0: initial guess % delta: error tolerance for the relative difference between two consecutive iterates % max_it: maximum number of iterations to be allowed % % iflag: 1 if a numerical solution satisfying

Posted in Uncategorized

## lesson13_ear_16_17_3

d=dict() for x in range(1,16): d[x]=x**2 print(d) d = {‘Red’: 1, ‘Green’: 2, ‘Blue’: 3} for color_key, value in d.items(): print(color_key, ‘corresponds to ‘, d[color_key]) keys = [‘red’, ‘green’, ‘blue’] values = [‘#FF0000′,’#008000’, ‘#0000FF’] color_dictionary = dict(zip(keys, values)) print(color_dictionary) color_dict

Posted in Uncategorized

## lesson13_ear_16_17_2

def recursive_list_sum(data_list): total = 0 for element in data_list: if type(element) == list: total = total + recursive_list_sum(element) else: total = total + element return total print( recursive_list_sum([1, 2, [3,4],[5,6]]))

Posted in Uncategorized

## lesson13_ear_16_17_1

x = 11 counter = 0 while x != 1: print x x = x / 2 counter = counter + 2 if counter > 6: break print counter print ‘new’ x = 12.5 counter = 0 while x !=

Posted in Uncategorized

## lesson12_ear_16_17_2

class Stack: def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def push(self, item): self.items.append(item) def pop(self): return self.items.pop() def peek(self): return self.items[len(self.items)-1] def size(self): return len(self.items) s=Stack() print(s.isEmpty()) s.push(4) s.push(‘dog’) print(s.peek()) s.push(True) print(s.size()) print(s.isEmpty()) s.push(8.4) print(s.pop()) print(s.pop())

Posted in Uncategorized

## lesson12_ear_16_17_1

class Queue: def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def enqueue(self, item): self.items.insert(0,item) def dequeue(self): return self.items.pop() def size(self): return len(self.items) q = Queue() print q.size() print q.isEmpty() q.enqueue(8.4) q.enqueue(18) print q.dequeue() print q.size()

Posted in Uncategorized