programming

Song_Writer Progress #3 "666"

second = 60
minute = 60*second
modes = "Ionian,Dorian,Phrygian,Lydian,Mixolydian,Aeolian,Locrian"
def main():
    def song_details():
            beat_division = input("what is the x/x beat division:") # a quarter note gets the beat, so four quarter notes a bar
            tempo = int(input("tempo is, in Beats Per Minute:"))
            song_length_sec = int(input("Song Length(in seconds):")) #song length, 165sec is nice
            song_length_min = song_length_sec/60
            print("-----------------------------------------------")
            print("The Beat Division is: "+str(beat_division)+".")
            print("The Tempo is: "+str(tempo)+" Beats Per Minute.")
            print("The Song Length is: "+str(song_length_sec)+" seconds.") 
            
            amount_of_beats = int(tempo*(song_length_min))
            print(amount_of_beats)
            
            
            
    song_details()
    
    
        

main()

Object-Oriented Programming

import numpy as np
class Coordinate(object):  #class tells python you are making an object. #class name/type(parent object)
    def __init__(self, x, y):  #defines attributes that let us interact with the object
        self.x = x  #these attributes only work with its class
        self.y = y

    def distance(self, dist):  #defines attributes that let us interact with the object
        dist = numpy.linalg.norm(x-y)
        x_diff_sq = (self.x-other.x)**2 #these attributes only work with its class
        y_diff_sq = (self.y-other.y)**2
        return(x_diff_sq + y_diff_sq)**0.5
#self is a parameter that references the instance of this class |  
#methods like __init__ are like a function that only work with this class
c = Coordinate(3,4)
zero = Coordinate (0,0)
print(c.distance(zero))