Questions: 5 831

Answers by our Experts: 5 728

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 & Filtering

The coordinates of different persons are given in the following dictionary.

position = ('A': (2, 5), 'B': (1, 7), 'C': (9, 5), 'D': (2, 6))

You will take 2 inputs for person X's location where the first

input specifies person X's current location in the x-axis and the second input specifies person X's current location in the y-axis.

Your work is to find the person closest to person X by

calculating the

distance between person X and every other person in the dictionary.

Hint: The distance between two coordinates is given by the

formula (You

need to import math):

math.sqrt((x2-x1)**2 + (y2-y1)**2)

Sample Input 1:

Enter person X's x coordinate: 3

Enter person X's y coordinate: 6

Sample Output 1:

D



Write a Python program that takes a string as an input where multiple numbers are separated by hashes(#). Your first task is to create a list of numbers and print it.

Your second task is to create a dictionary that will have the index of the

list as key, and for the even indices, multiplication from start to that index as value, while for the odd indices, summation from start to that

index as value. Finally, print the dictionary.


Sample Input 1:

1#2#3#4


Sample Output 1:

[1, 2, 3, 4]


(0:1, 1:3, 2:6, 3:10}

Sample Input 2:

5#6#7

Sample Output 2:

[5, 6, 7]

{0: 5, 1:11, 2: 210}


Write a Python program that reads a number and finds the sum of the series

of 1 + 33 + 111 + 3333 +....+N terms. Then it puts the reverse digit of the sum to a list and prints it. [Cannot use built-in reverse() or reversed()]

Sample Input 1:

5

Sample Output 1:

Sum of series: 14589 Reverse sum of series in list: [9, 8, 5, 4, 1]


Input: ramisgood


goodforall.



Output: good.




How to print square pattern like this.



When input=4.



1 2 3 4



5 6 7 8



9 10 11 12



13 14 15 16




The python list called customer_list contains a list of 6 objects of the Customer class. Each customer object as 2 public attributes: name and balance. Which of the following statements will correctly add R250 to the first customer object's balance?

Write a program to print T in all scales viz Celsius, Fahrenheit, and Kelvin.


Create a Python code that will accept two numbers from the user and prints "True" if it satisfies the condition and "False" otherwise. Use comparison operators ">", "<=", "!=", ">=", and "<".

you are working as a freelancer. A company approached you and asked to create an algorithm for username validation. The company said that the username is string S .You have to determine of the username is valid according to the following rules.

1.The length of the username should be between 4 and 25 character (inclusive).

2.Valid username must start with a letter.

3 Valid username can only contain letters, numbers, and underscores characters.

4 Valid username cannot ends with the underscore character and also doesn't accept the special characters.


INPUT: The first line contains an integer T representing the number of test cases.

The first line of each test cases input contains a string.


OUTPUT: Each test case gives a Boolean value as output(true or false)


sample Input:

3

google

Google_123

google@123


sampleOutput

true

true

false

sample input 2

HelloPython

#Coder

CoderIt

sampleoutput 2

true

false

true



Create a program that will accept two numbers and print the product, quotient, sum, difference, remainder, exponent, and floor division. First number will be the left operand for quotient, difference, remainder, exponent, and floor division.

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS