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

Convert the Number


Given a number having ten digits, convert it to a string following the below-mentioned rules.


Rules for conversion:

1.separate the number into a set of four-three-three digits

2.Use the following prefixes for successive digits

a.Single numbers: just read them separately

b.Two consecutive numbers: double

c.Three consecutive numbers: triple

d.Four consecutive numbers: quadruple


Input

The first line of input is a string of ten digits.



Sample Input1

9887666668

sample Output1

nine double eight seven triplesix double six eight


Sample Input2

9090407368

Sample Output2

nine zero nine zero four zero seven three six eight


You can use a minus sign to make a negative number like -2. What happens for each of the following and why?

>>> 2++2

>>> 2--2

>>> 2+-2

>>> 2-+2


Given an integer N as input. Write a program the yellow right-angle pattern of N lines as bellow.



Note:There is a space after each asterisk (*) Character.



Input



The first line is an integer N



Explanation



In the given example the yellow right angled triangle of side 5 .Therefore, the output should be.



*



* *



* *



* *



* * * * *



Sample Input 1



4



Sample Output 1



*



* *



* *



* * * *




you cannot use built-in functions or NumPy or Pandas!

1. Write a function which finds all Pythagorean triplets of triangles whose sides are no greater than a natural number N.

2. Given a list of integers, write a function that finds the smallest and the largest value of this list. Given a list of numbers, write a function which finds their standard deviation


 Integer Pairing

by CodeChum Admin

Now this one's a tad bit tricky, but you can definitely do it!


Instructions:

  1. Input five integers in one line, with each integer separated by a space.
  2. Add the 1st and 2nd integers together, store the sum inside a variable.
  3. Add the 3rd and 4th integers together, store the sum inside a variable.
  4. Multiply the two sums with each other and raise the product to the power of the 5th integer
  5. Print out the result.

Input

A line containing five integers separated by a space.

1·2·3·4·5

Output

A line containing an integer.

4084101

Input Combination

by CodeChum Admin

We've tried adding together integers, now how about strings?


Instructions:

  1. Input two strings in one line, separated by a space.
  2. Concatenate the two strings and print out the result.

Input

A line containing two strings separated by a space.

hello·world

Output

A line containing the concatenated string with no spaces.

helloworld




even or odd . write a program to check if the given number is even or odd


You task is to write a program that will continuously add friend data to a list named friends until the user enters "No". The program must display the contents of friend list.


friend's data to be collected:

Last name

First name

Birthdate

Gender

Contact No.



Validation:

Name must not be empty.

Must check the validity of the birth date.

Gender either F or M only.

Contact No. must be exactly 11 digits.


Display "Invalid Input" and ask the user to input another value.

Input

Friend's data

Tortor
Rhea
12/25/1990
F
09172345678
Yes
Nayang
Iya
11/11/1995
F
09172415679
No

Output

Name: Rhea Tortor
Birthdate: December 25, 1990
Gender: Female
Contact No.: 09172345678

Name: Iya Nayang
Birthdate: November 11, 1995
Gender: Female
Contact No.: 09172415679





given integer n as input.write a program to print the sum of series of 1+11+111+...n terms


4. Decimal x Decimal

by CodeChum Admin

Now that we're done with integers, we're moving on to decimals!


Instructions:

  1. Input three decimal numbers with only two decimal places in one line separated by spaces, store them inside variables.
  2. Multiply the 1st and 2nd decimal numbers, store the product.
  3. Divide the product of the 1st and 2nd decimal numbers with the 3rd decimal number, then print out the quotient with only two decimal places.

Input

A line containing three decimal numbers with two decimal places separated by a space.

1.53·2.25·1.23

Output

A line containing the result with two decimal places.

2.80




LATEST TUTORIALS
APPROVED BY CLIENTS