Posts

4/9 Create

1. What did you accomplish today?

My code is pretty much done, but today I decided to (attempt) to put each question into its own function so make_choice(money) wouldn't be as long as it is. This isn't really necessary, but I just want to condense it down as much as I can.

2. Explain any code written today. What does it do?


I made a function called choice_1(money) that holds the process for question 1 in it; I hope to also do this for the other functions or just make one universal function that can process any question asked. Right now it's not really working, but I hope to resolve it so the code can run smoothly and also be shorter.

3. What went wrong today? How did you solve it?


When I made my new function, the 'money' stopped working again. I think that variable is cursed. I haven't been able to solve this problem yet, but I hope to tomorrow so I can begin my responses. The values keep replacing each other (unless if it was in make_choice(money), which ran smooth…

4/8 Create

1. What did you accomplish today?

Today I finished adding all of my questions to the sets. Now the game is completely playable. My algorithm that uses math/logic is make_choice(money) since it uses if/else statements and has a money counter. clear_board() calls two other functions in it, with make_choice(money) being one of them. My abstraction would be make_choice(money) because it's included in the while loop and is used every single time in my program.

2. Explain any code written today. What does it do?


I added an 'if choice != 10: print ("Please answer in the form of who is or what is...").' This was added in order to avoid it appearing when typing '10' to exit. I also added more questions to my program so it's completely done.

3. What went wrong today? How did you solve it?


Nothing really went wrong, I just fixed the 'if choice' so it wouldn't print the statement I previously mentioned when trying to exit. Nothing else went wrong today.

4. …

4/5 Create

1. What did you accomplish today?

I fixed the money problem (for the 800th time), now allowing it to be correctly printed. I also added in more questions after I fixed the problem. 2 more question lists have been added, and they all work correctly, thankfully.

2. Explain any code written today. What does it do?


The line 'money += set_1[2]' under each 'if answer' is correct statement, that adds the correct amount of money to the total if the answer was correct. When I had it in the same line as the 'Correct!' statement, it wasn't working since I had it as %d. This has all been completely fixed and now I simply put % money after the line so it prints what was added beforehand rather than messing up the code.

3. What went wrong today? How did you solve it?


As I mentioned above, I've been having issues with the money counter all week. I finally fixed the placement of the code by putting the counter after an 'if' statement rather than in the 'correct!…

4/3 Create

1. What did you accomplish today?

I put all of my corresponding questions, answers, and money values into their own list so when a certain action is called, the corresponding place in the list will be printed, instead of having extra lines of code. This made it a lot easier to condense things down.

2. Explain any code written today. What does it do?


I added set_1 and set_2 which are lists that hold each 3 different values per question set -- the question itself, the answer, and money value. I'm working on recreating my make_choice(money) function by adding in these lists, and am now writing 'print (set_1[0])' which holds the question, and then prompts the user for the answer. I'm planning on using this pattern throughout the function.

3. What went wrong today? How did you solve it?


For some reason, I can't do '% money += set_1[2]'. It's not allowing me to take the current money value and add the place value of 2 from my list, which holds the amount of money …

4/2 Create

1. What did you accomplish today?

I didn't add anything new to my code today, but I fixed an ongoing problem that I had been dealing with. I have a 'Type '10' to exit' prompt in my terminal, but when a user typed 10, it wasn't exiting and instead kept looping. I finally fixed this issue, so everything should run smoothly now.

2. Explain any code written today. What does it do?


My while loop was updated to 'while choice != '10': choice, money = make_choice(money)' to include both parameters when printing values. I also included 'return (choice, money)' at the end of my function make_choice(money) so both values would be returned properly.

3. What went wrong today? How did you solve it?


By fixing my 'return' line, it finally allowed my code to break free of the while loop when typing '10' into the terminal. This issue occurred because it was only returning the 'money' value which could range from 200-800, and never be 10…

4/1 Create

1. What did you accomplish today?

Today I worked on solving my problem with the whole 'money' situation. I didn't add any new questions or functions, but rather focused on a major part of my code that I needed to solve in order to continue adding other things.

2. Explain any code written today. What does it do?


I added a while loop instead of play_again() in order to loop through my code if the user didn't type '10' (which is exiting the code). The play_again() function was messing up my money counter so this is a good alternative.

3. What went wrong today? How did you solve it?

Today I solved my money problem; I removed the play_again() function from my code which was messing up the values, and simplified my code down into a version 2 so I could find what was really going wrong. My code kept returning incorrect values, so after I removed play_again and put everything into a while loop (temporarily), it was finally fixed.


4. On a scale of 1-10 how far are you along w…

3/29 Create

1. What did you accomplish today?

I added more questions to my code. I'm at question 4, so I'm hoping to implement 5 more. I hope to create functions for each question since there's a lot of repetition within the code that could definitely be condensed (abstraction!!)

2. Explain any code written today. What does it do?


I didn't add any new functions, but I added 2 questions; one for countries and one for languages. I unfortunately still can't get my money counter to work, so I hope to work on that once all of my questions are added in so the total can be correct accordingly.

3. What went wrong today? How did you solve it?


I was actually trying to create functions for each question but I'm going to need to spend a whole class on that. I have 'money' in a parameter within my make_choice function, so it's going to have to be spread to 9 different functions (if even possible). I'm not sure if I can do that, but I'll have to try and see. The money cou…