|
I had a quiz that I got a few wrong on and I was curious if ya'll could illuminate me.quote:Given: Thinking about this question, I'm fairly certain it returns as false. P & Q return true and r or s return false. So true and false = false. Not is a reverse operator so not(false)=true. Am I wrong? Additional quiz question: how many red triangles does the following code draw? 0,1,2,3? quote:def f(color): I'm fairly certain this wouldn't draw any because it has a syntax error. ASSUMING the syntax error was fixed, this still wouldn't draw any triangles because num is never declared before it's used?
|
# ¿ Mar 13, 2024 21:19 |
|
|
# ¿ May 3, 2024 22:04 |
|
My brain is a random answer generator you see. I answered true on the quiz and it was marked wrong so I'm not crazy.
|
# ¿ Mar 13, 2024 21:29 |
|
Dijkstracula posted:Well, first you say it evaluates to false (incorrect) but then after you show your steps you say it evaluates to true (correct), so, there's a correct answer in there somewhere Oh, ok. This is an intro class. I'm new to this. fair point, g is never called aaaannd the code has a syntax error. I'ma mail my professor. Thank you fellas, you're all gorgeous people.
|
# ¿ Mar 13, 2024 21:32 |
|
Magnetic North posted:Are you sure you transcribed it correctly here? Maybe not. Let me transcribe it exactly how it's set: 1. pre:Given: p = true q = true r = false s = false Determine the answer to the following: not((p or q) and (r or s)) pre:def f(color): Rect(0,0,100, 100, fill=color) def g(color, num): if (num == 7): f(color) if (color == "red): f("black") else: f(color)
|
# ¿ Mar 13, 2024 21:33 |
|
mystes posted:If this is a college class this might be a good time to try to transfer to another section where the professor isn't an idiot if possible, before you get more quiz/test questions that are bizarre/nonsensical and/or have incorrect answers Oh my lord in heaven, you have no idea. This professor is awful. I thought I was just really bad at programming until I looked at her rate my professor and it's just a trail of 1.0s that goes on for pages with everyone universally agreeing she sucks. It's the middle of the semester. I'm stuck with this.
|
# ¿ Mar 13, 2024 21:40 |
|
Jesus, I feel like I'm having a stroke. Help me goons:pre:counter = 10 while (counter>0): counter = counter//2 5 4 The loop never ends 3 My gut says 4 times. 10/2 =5, 5//2 =2, 2//1 = 1 //2 = 0. pre:Which of the following values for n will cause the loop to never end/terminate? Group of answer choices 10 8 7 9 pre:Re write as a correct loop based on the three parts of the loop doAgain = "y" while doAgain == "y": word = input("Enter a word:") print("First letter of " + word + " is " + word[0]) doAgain = input("Type ‘y’ to enter another word and anything else to quit.") print("Done!") BUT THIS ALREADY WORKS?! edit: I thought about this and this loop has no exit condition. so, pre:1 doAgain = "y" 2 3 while doAgain == "y": 4 5 word = input("Enter a word:") 6 7 print("First letter of " + word + " is " + word[0]) 8 9 doAgain = input("Type ‘y’ to enter another word and anything else to q uit.") 10 if doAgain != "y": 11 print("Done!") I may be missing something here but whenever I ran that first bit of code with a print(counter) it just outputs zero. A Festivus Miracle fucked around with this message at 21:04 on Apr 21, 2024 |
# ¿ Apr 21, 2024 20:58 |
|
RPATDO_LAMD posted:i would assume by "correct loop" they do not mean "runs without errors" but "follows whichever dogmatic loop style-guide the professor told you to use in lecture" It's this. Another gem posted with roughly as much context as I had from her: pre:number = int( input ("Enter a value greater than 0")) product = 0 while (number >=0): for x in range (1, 3): product = number * x + product number = int( input ("Enter a value greater than 0")) print (product)
|
# ¿ Apr 22, 2024 05:39 |
|
|
# ¿ May 3, 2024 22:04 |
|
I'm going to take another class with this lady this fall, and I'm starting to realize that not only is she hopelessly incompetent at teaching, she's absolutely stuck on dogmatic ideas of what code should look like. I have no choice, it's the only offering of the class at the college
|
# ¿ Apr 22, 2024 05:41 |