Python Answers

Questions answered by Experts: 5 288

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

Create a Python script that will accept three integers and will check each input number. If the input number is EVEN it will display the square of cube of the number and if the number is ODD it will display the square of the number.




Sample Output




Number 1: 5




Number 2: 8




Number 3: 3 The square of 5 is 25




The cube of 8 is 512 The square of 3 is 9.

program to find the sum of even numbers in python


Start with an infinite two dimensional grid filled with zeros, indexed from (1,1) at the bottom left corner with coordinates increasing toward the top and right. Given a series of coordinates (r, c), where ris the ending row and cis the ending column, add 1 to each element in the range from (1,1) to (r, C) inclusive. Once all coordinates are processed, determine how many cells contain the maximal value in the grid. Example upRight = ["14", "23", "4 1"] The two space-separated integers within each string represent rand c respectively. The following diagrams show each iteration starting at zero. The maximal value in the grid is 3, and there is 1 occurrence at cell (1, 1). Initial Grid 40 0 0 0 30 0 0 0 20 0 0 0 1 0 0 0 0 1 2 3 4 Step 0:r=1, c = 4 Step 1: r = 2, c = 3 Step 2:r =4,c= 1 4000 0 4 0 0 0 0 4 100 0 30 000 3000 0 3 1000 2 0 0 0 0 2 1 1 1 0 2 2 1 0 1 1 1 1 1 1 2 2 2 1 1 3 2 2 1 1 2 3 4 1 2 3 4 1 2 3 4

write a program that displays the following menu:            

Geometry Calculator

1.     Calculate the Area of a Circle

2.     Calculate the Area of a Rectangle

3.     Calculate the Area of a Triangle

4.     Quit

  • The must be a main function that will display the menu and will ask for user's choice.
  • For each choice 1, 2 and 3, create an appropriate user-defined function for each task.
  • Provide validation for input.


Score will be updated after checking for the following:

  • 40 points deduction if there is no user defined function created at all.
  • 20 points deduction if all user defined function are void functions and no arguments.

Input

1. data

Output

Geometry·Calculator
1.·Calculate·the·Area·of·a·Circle
2.·Calculate·the·Area·of·a·Rectangle
3.·Calculate·the·Area·of·a·Triangle
4.·Quit
Choice:·2
Enter·length:·5
Enter·width:·4
The·area·of·the·rectangle·with·length·5·and·width·4·is·20.
Geometry·Calculator
1.·Calculate·the·Area·of·a·Circle
2.·Calculate·the·Area·of·a·Rectangle
3.·Calculate·the·Area·of·a·Triangle
4.·Quit
Choice:·4
Bye!







Create a Python script which will compute the TOTAL Sales in Grapes Store. The grapes is sold at 235.75 per kilo. 5% discount is given to customers that will buy 5 kilos and above. Compute also the CHANGE after the customer tendered their money. Format the display with two decimal digits.


Sample Output:

GRAPE STORE:

No. of Kilos: 6

Total Price: 1414.50

Discount: 70.73

Discounted Price: 1343.77

CASH: 1500

Change: 156.23


I need the code to have an output stated above.


Create a Python script that will accept three integers and will check each input number. If the input number is EVEN it will display the square cube of the number and if the number is ODD, it will display the square of the number.


Sample Output:

Number 1: 5

Number 2: 8

Number 3: 3

The square of 5 is 25

The cube of 8 is 512

The square of 3 is 9


I need the code to have an output stated above.


Develop a program logic that performs arithmetic functions which design to prompt values

for the variables from users. Both variables will be passed to methods named area() and

perimeter() for a trapezium. Compute the values of two arguments, respectively so each

method should perform the appropriate computation and display the results. Present all

requirements to be prepared to solve this problem.



list=[50,0,10,30]

using recursive function find min to max in ascending order.


Write a python function Count_Freq(A) which take a dictionary containing numbers. The function will return a dictionary containing key as a number and value as frequency defining how many times the number is repeating in the dictionary.

Note:

write a code without using counter function?

 

Example-1

Example-2

Input:

{'V': 10, 'VI': 10, 'VII': 40, 'VIII': 20, 'IX': 70, 'X': 80, 'XI': 40, 'XII': 20}

 

Output:

({10: 2, 40: 2, 20: 2, 70: 1, 80: 1})

Input:

{'V': 10, 'VI': 10, 'VII': 10, 'VIII': 10, 'IX': 20, 'X': 30, 'XI': 40, 'XII': 20}

Output:

({10: 4, 20: 2, 30: 1, 40: 1})



Found Ya!

by CodeChum Admin

Let's now try finding a certain digit into an integer! Come and join in on the fun and code with me!


Instructions:

  1. Input two integers in one single line. The first inputted integer must be within 0-9 only.
  2. Using loops, identify if the first inputted integer (0-9) is present in the second inputted integer. If it is found, print "Yes". Otherwise, print "No".

Input

A line containing two integers separated by a space.

1·231214238

Output

A line containing a string.

Yes




LATEST TUTORIALS
APPROVED BY CLIENTS