12 Mar PMCA Sunday 16:00 Python Homework 20.03.08.
Question: Complete the code we did for a simple calculator. Add the button to do subtraction, division and find the exponent for num1^num2...
Question: Complete the code we did for a simple calculator. Add the button to do subtraction, division and find the exponent for num1^num2...
Question: Create the following * pattern image base on your input Hint: Remember when we multiply a string by a number, the string is repeated the number times. >>> '*' * 10 '**********' Also you would need 2 for loops to solve the question Sample Input 1: 3 Sample Output 1: *** ** * * ** *** Sample Input 2: 5 Sample Output...
Question: Count the number of cars passing each other on the street. The goal is to count passing cars. We say that a pair of cars (P, Q), where 0 ≤ P < Q < N, is passing when car P is traveling to the east and...
Question: The Body Mass Index (BMI) is one of the calculations used by doctors to assess an adult’s health. The doctor measures the patient’s height (in meters) and weight (in kilograms), then calculates the BMI using the formula BMI = weight / (height * height) Write a program which...
Question: Write a method that reads in three angles (in degrees). State the type of the triangle based on the conditions below: If all three angles are 60, output Equilateral. If the three angles add up to 180 and exactly two of the angles are the...
Question: You have come up with the following compression technique: for each symbol, write down the number of times it appears consecutively, followed by the symbol itself. This compression technique is called run-length encoding. Given a sequence of characters, write a program to encode them in this...
Question: Create the following * pattern image base on your input Hint: Remember when we multiply a string by a number, the string is repeated the number times. >>> '*' * 10 '**********' Also you would need 2 for loops to solve the question Sample Input 1: 3 Sample Output 1: *** ** * * ** *** Sample Input 2: 5 Sample Output...
Question: Write a code that prints the multiplication table of a number. Use recursion, the code shouldn’t have any for loop or while loop Sample Input: 3 Sample Output: 3X1=3 3X2=6 3X3=9 3X4=12 3X5=15 3X6=18 3X7=21 3X8=24 3X9=27 3X10=30...
Question: Write a program to ask the user for five names. The program should store the names in a list, and print them all out at the end. It should look something like this: Sample input: Enter 5 names: Tony Paul Nick Michel Kevin Sample output: The names are Tony, Paul, Nick, Michel, Kevin Hint: You can...
Question: Use TKinter to create 6 buttons as following picture: ...