Skip Navigation
InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)PA
palmtrees2309 @lemm.ee
Posts 1
Comments 22
Hi everyone, this is BestOf: a repository of different things I find to be the best in their category
  • But use correct channels dude. Make a Single post in relevant community on lemmy, mastodon, hackernews, heck even a reddit post. No shame in sharing your hardwork but respect community rules. Side note great project. I will star it.

  • Why is my output not formatted as a string?
  • After the split x becomes (1 and z becomes 1). They can't be converted to float. I think that's why. Let me run the code. Edit - Also as you are returning a, b, c from splitter but Python functions return a single object. The a, b, c turns to a tuple. But you are using js syntax I think. So we have to unwrap inside the calculate function.

    Now my original comment is not useful but you can try to introduce a conditional to check of the numbers x and z are actually numbers before converting to floats

    # Ask user to enter an expression and display output
    
    def main():
        expression = input("Expression: ")
        print(calculate (splitter (expression)))
    
    # Split expression into components and assign to variables as float values
    
    def splitter (expression):
        print(expression)
        x, y, z = expression.split()
        print(expression.split())
        return x, y, z
    
    # Calculate expression result
    
    # Changes Beginning
    def calculate(numbers):
        x,y,z = numbers
    # Changes End
    
        x, z = float(x), float(z)
        if y == "+":
            return str(round((x + z), 1))
        elif y == "-":
            return str(round((xz), 1))
        elif y == "*":
            return str(round((x*z), 1))
        else:
            return str(round((x / z), 1))
    
    main()
    
    
  • India v Pakistan: Cricket's ultimate grudge match in the desert
  • At this point, these matches are becoming boring. Yeah india played against Pakistan sixth time in 2 years. Can't wait to watch it. Also India and Pakistan have bad blood between them but still come to play together because money rules.

  • I have created my Portfolio site as a computer underGrad. Please rate / roast it.

    Hello lemmy! I am a underGrad in Delhi, India. This is my portfolio website made with React, Typescript and Tailwind. Please go through it and if possible rate it.

    14
    Hello Lemmy World!
  • Nice to have you Karna. Welcome to lemmy. But you have posted on c\news which is a community for world news and not for new users introduction. As you are involved in Audio, Engineering and Artists you can find other communities which better suit your preference. Also you can find community based on location like Sydney and Australia . As this post is in wrong community I would have to down vote your post. But you are free to checkout other relevant communites and post there.

    Hope you enjoy lemmy.😊👋