Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Roman number to decimal #2018

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

collateralusr
Copy link

The value function is used to map Roman numerals to their decimal values, and the romanToDecimal function converts a Roman numeral to an integer using the given mapping.

@vanshdhiwar09
Copy link

nterms = int(input("How many numbers")) n1,n2 = 0,1 count = 0 if nterms <= 0: print("Please enter a positive integer") elif nterms == 1: print("Fibonnaci sequence upto",nterms,":") print("n1") else: print("Fibonnaci sequence.") while count < nterms: print(n1) nth = n1 + n2 n1 = n2 n2 = nth count += 1

@@ -0,0 +1,40 @@

def value(r):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use switch statement, they are far better instead of this.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea

while (i < len(str)):
s1 = value(str[i])
if (i + 1 < len(str)):
s2 = value(str[i + 1])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leetcode problem idea...I see.

Copy link

@dexterharrison29 dexterharrison29 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this code is so fucking awful... Lemme pullup with a better one

Copy link

@dexterharrison29 dexterharrison29 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants