top of page
learn_data_science.jpg

Data Scientist Program

 

Free Online Data Science Training for Complete Beginners.
 


No prior coding knowledge required!

Roman To Decimal

Updated: Sep 19, 2021


The simple idea is to calculate decimal numbers from roman so for that we have five steps process .The reason we are doing this is to get the idea of list and function to calculate the decimal number. Step 1. We defined a list of values consisting of roman letters and their significant values. roman = { 'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000,

}

Step 2. Then we Calculate the length to know how long the value is as per list defined or is it exceeding it. for index in range(len(romannumbers) - 1):

Step 3. We checked the first symbol using the index value and followed by the next digit and it’s value. previous = romannumbers[index]

Step 4. Similarly we keep converting digit by digit checking the previous is always greater than next value. if previousNumber< nextNumber : result -= previousNumber else: result += previousNumber

Step 5. Hence we calculate the result as in whole and print it. result+=lastNumber

print(result)



For Example : MCDXLIX --> 1449

XX-->20

Click on the image to check full code




 
 
 

1 commentaire


Data Insight
Data Insight
19 sept. 2021

Your first statement is contrary to your topic. Use the code snippet functionaliy to insert your code. And give an example of the use of your code.

J'aime

COURSES, PROGRAMS & CERTIFICATIONS

 

Advanced Business Analytics Specialization

Applied Data Science with Python (University of Michigan)

Data Analyst Professional Certificate (IBM)

Data Science Professional Certificate (IBM)

Data Science Specialization (John Hopkins University)

Data Science with Python Certification Training 

Data Scientist Career Path

Data Scientist Nano Degree Program

Data Scientist Program

Deep Learning Specialization

Machine Learning Course (Andrew Ng @ Stanford)

Machine Learning, Data Science and Deep Learning

Machine Learning Specialization (University of Washington)

Master Python for Data Science

Mathematics for Machine Learning (Imperial College London)

Programming with Python

Python for Everybody Specialization (University of Michigan)

Python Machine Learning Certification Training

Reinforcement Learning Specialization (University of Alberta)

Join our mailing list

Data Insight participates in affiliate programs and may sometimes get a commission through purchases made through our links without any additional cost to our visitors.

bottom of page