Question:
Create a loop between 1 to 20.
Print “fizz” if the number is divisible by 3
Print “bizz” if the number is divisible by 5
Print “fizzbizz” if a number is divisible by both 3 and 5.
Otherwise, print the number itself.
Hint: You should use...
Question:(You could use stack to solve the problem)
Suppose you have to evaluate an expression like A*B*C*D*E where A,B,C,D and E are matrices. Since matrix multiplication is associative, the order in which multiplications are performed is arbitrary. However, the number of elementary multiplications needed strongly depends...
Question:
Make changes of the program we made in the class, so the enemy spaceship could complete the following tasks:
more new enemies will keep entering the game at the random x position from the top of the screen.
the enemy can bounce back when...
Question:(You could use stack to solve the problem)
Suppose you have to evaluate an expression like A*B*C*D*E where A,B,C,D and E are matrices. Since matrix multiplication is associative, the order in which multiplications are performed is arbitrary. However, the number of elementary multiplications needed strongly depends...
Posted at 10:37h
in
Uncategorized
by admin
Question:
Continue to program the code we made in the class at the bottom of this page. Try to use for loop to create buttons from 1-9, so the tkinter window would display as below:
Hint:
You can use “for i in range(1, 10):” or “for i in ‘123456789’:” to build these 9 buttons,...
You can do Question 1~ 3 in Python IDLE:
Question 1.
Use float() to create a number from a string like ‘12.34’. Make sure the result is really a number!
Question 2.
Try using int() to create an integer from a decimal number like 56.78. Did the answer get rounded up...