CS160- Assignment 7 Solved


One challenge that I faced that I wasn’t expecting was the difficulty of figuring out what to make dinner. I’m living off campus and so I don’t have a meal plan to go eat at the cafeterias on campus. It’s a challenge I’m still dealing with now, I’m trying to diversify what I eat and not just pumpkin waffles all the time.

One thing exciting that I wasn’t expecting is that all my professors are nice and caring. Yes I know I’ll have a professor that is grumpy or just off putting but overall far as my experience grows all of my professors genuinely care and want to see you all succeed. This makes learning a whole lot easier!


Problem Analysis:

I need to have every letter be its own function. The only global statements are import random and import turtle and main. Make sure to use penup() and pendown() to hide or show the pen marks. Also I will have to make four different ones, one my name and the other three I can choose. The user will input for how many words they want and my program will pick at random which word it’ll draw first and so on.

Program Design:

First in main after all the checks to see if the users input was valid, we’ll declare some variables (they’re ints). wordsDisplayed = 0. After the declarations, we’ll have a while loop, while(wordsDisplayed!= user_input): Then in the while loop we’ll declare the random number (random_num = randint(1,4)). Next our first if statement, if(random_num==): Then inside it wordsDisplayed +=1, firstWord(). And that’s the first if statement. After that they’ll be three sequential elif statements like the one above but with the number according to it’s position. (for random_num = 2, wordsDisplayed+=1, secondWord(). My while loop has wordsDisplayed != user_input because we have to account for the chance that a number may be randomly picked more than once.

Now for all these word functions we’ll have “Adison” for the first word, “wants” for the second word, “an” for the third word, and “A” for the fourth word. For function firstWord we’ll draw “Adison”. Inside this function I’ll have function drawA, then function draw_d and so on till I complete the first word. I’ll do this similar process for the other words.


Implementation/Extra credit:

My code on the py file


Also I have my program set up so it clears the screen between each word generated.