Each of the following must be done in one line using the techniques we have covered in class: comprehensions, casting, and conditional expressions. Do not include “return” in your code. Do not use nested for loops.
Blog
Describe what the main window would look like when the follo…
Describe what the main window would look like when the following code is executed, but no buttons have been pressed. Assume all imports have been done and no errors occur. class MainWindow(QWidget): def __init__(self): super().__init__() self.setWindowTitle(“Food”) box = QVBoxLayout() mybutton = QPushButton(“cats”) mybutton.clicked.connect(self.on_button2_clicked) box2 = QHBoxLayout() box2.addWidget(mybutton) abutton = QPushButton(“dogs”) abutton.clicked.connect(lambda x : self.setWindowTitle(“Yummy!”)) box.addWidget(abutton) self.setLayout(box) def on_button2_clicked(self): self.setWindowTitle(“Pets!”)if __name__ == ‘__main__’: app = QApplication(sys.argv) main = MainWindow() main.show() sys.exit(app.exec_())
list(set(list(“aaa”))) Resulting Value of Expression (1.5 po…
list(set(list(“aaa”))) Resulting Value of Expression (1.5 points): [value4]Data Type of Expression (1.5 points): [type4]
What would be contained in alist: alist = [[1, -2, -5].remov…
What would be contained in alist: alist = [[1, -2, -5].remove(i) for i in range(1, -5, -3)]
What would be contained in a_dict: adict = {a:b if a > b els…
What would be contained in a_dict: adict = {a:b if a > b else b*2 for a,b in zip(‘cats’, ‘dog’)}
The following OOP coding questions are interrelated. Refer…
The following OOP coding questions are interrelated. Refer to each one for hints as to how to solve the next question. The following code is useful for each question:
[“happy”, “summer”, “everyone”].sort()Resulting Value of Exp…
[“happy”, “summer”, “everyone”].sort()Resulting Value of Expression (1.5 points): [value3]Data Type of Expression (1.5 points): [type3]
Describe in one sentence how the main window looks different…
Describe in one sentence how the main window looks different after mybutton has been pressed one time? If nothing will have changed simply put “the window will not have changed”. class MainWindow(QWidget): def __init__(self): super().__init__() self.setWindowTitle(“Food”) box = QVBoxLayout() mybutton = QPushButton(“cats”) mybutton.clicked.connect(self.on_button2_clicked) box2 = QHBoxLayout() box2.addWidget(mybutton) abutton = QPushButton(“dogs”) abutton.clicked.connect(lambda x : self.setWindowTitle(“Yummy!”)) box.addWidget(abutton) self.setLayout(box) def on_button2_clicked(self): self.setWindowTitle(“Pets!”)if __name__ == ‘__main__’: app = QApplication(sys.argv) main = MainWindow() main.show() sys.exit(app.exec_())
[“C”, “S”, [(2), (3, 1), (6,)]][ 2 ][ 0 ]Resulting Value of…
[“C”, “S”, [(2), (3, 1), (6,)]][ 2 ][ 0 ]Resulting Value of Expression (1.5 points): [value1]Data Type of Expression (1.5 points): [type1]
Feingold’s (1990) meta-analysis of predictors of liking reve…
Feingold’s (1990) meta-analysis of predictors of liking revealed that men generally value physical attractiveness ____. This gender difference was larger when the liking measure was ____.