Hello all this is my first post!
I'm trying to write a simple chord generator using roman numerals. My goal is to just print a random selection up to 8 chords from the list, and add some chord qualities to my list. This is what I have so far.
import time
import sys
import random
def print_slow(str):
for char in str:
time.sleep(0.03)
sys.stdout.write(char)
sys.stdout.flush()
# Welcome to the Chord Generator.
print_slow("Welcome to the Chord Generator.\n")
print_slow("Randomizing chords\n")
print_slow("....................\n")
chords = ["I","i","II","ii","III","iii","IV","iv","V","v","VI","vi","VII","vii"]
random_chord = random.choice(chords)
for chord in chords[0:7]:
random_chord += chord + " "
random_chord.append("M" or "m" or "M7" or "m7" or "7" or "m7b5" or "dim")
print(random_chord)
My two issues right now are:
- I run the code over and over and sometimes there wont be any spacing, like so
IVI i II ii III iii IV
- I get this error trying to append the list:
str' object has no attribute 'append'
I know I'm doing something wrong just not sure what, I want the chord qualities to just random attach themselves to whatever roman numeral it selects. I'd like to add more and inversions as well but for now I'm just trying to get this to work!
Aucun commentaire:
Enregistrer un commentaire