Romanizer

Convert numbers into roman numerals.

Example

numbers = [1,49,23]

Looking at the conversions above, 1 is represented as I(capital I which is roman number), 48 is 40 + 9, so XLIX, and 23 is XXIII.

The return values are [‘I’,’XLIX’,’XXIII’].

Explanation:

Input: [1,2,3,4,5]

1 corresponds to roman numeral I

2 corresponds to roman numeral II

3 corresponds to roman numeral III

4 corresponds to roman numeral IV

5 corresponds to roman numeral V

Output: [‘I’,’II’,’III’,’IV’,’V’]

dict={'I':1,'II':2,'III':3,'IV':4,'V':5,'VI':6,'VII':7,'VIII':8,'IX':9,'X':10,'XL':40, 'L':50,'XC':90,'C':100,'CD':400,'D':500,'CM':900,'M':1000} val=sorted(list(dict.values()),reverse=True) Number=list(map(int,input('Enter any numbers : ').split(' '))) L=[] for x in Number: i=0 str='' while x!=0: if i < len(val): if val[i]<=x: x=x-val[i] str+=list(dict.keys())[list(dict.values()).index(val[i])] else: i+=1 else: break print(str) #you can use string to append all values to display at once.

Sample Output Image ?

Input_1:

Enter any numbers : 1 49 23

Output:

I

XLIX

XXIII

Input_2:

Enter any numbers : 1 2 3 4 5

Output:

I

II

III

IV

V

Input_3:

Enter any numbers : 75 80 99 100 50

Output:

LXXV

LXXX

XCIX

C

L

**Morae Q!**

->Convert Numbers into Roman Numerals

->Given the string s, return the size of the longest sub-string

->Given an array of string words. Return all strings in words which is sub-string of another word in any order.

->Return the minimum positive value of startValue such that the step by step is never less than 1.

->Given the number k, return the minimum number of Fibonacci.

->Given a string s of zeros and ones, return the maximum score after splitting the string

->Given a sorted array and a value x,Write a efficient functions to find floor of x.

->Print all numbers less than n which are having digits only 3 or 7 or both.

->Function that returns true if given array can be divided into pairs.

->Find the smallest element in the list that is larger than the given target.

->Print the First N prime numbers.

->The Chef’s Binary Tree.

->The minimum number of strikes he will have to make.(so that all his enemies have the same name)

->Sum of Natural Numbers.

->Sum of the Input.

->Find the Sum of the Series: 1 + 1/2 + 1/3 + .. + 1/N.

->Put Even and Odd elements in a List into Two Different Lists.

->Python Program to Merge Two Lists and Sort it.

->Median of Three.

->Python Program to Find the Largest Number in a List.