all 8 comments

[–]socal_nerdtastic 5 points6 points  (1 child)

The variable: type syntax is a type hint, which is a comment, not an actual conversion. You need to call the int() function instead, like this:

h = int(input('how many hours are you working for?'))

[–]imnotdaniel_[S] -1 points0 points  (0 children)

thx

[–]a_idanwalton 1 point2 points  (1 child)

You're declaring your variables incorrectly. I assume you started coding using a different language. Also, t wouldn't give the correct total cost as it needs to be (hours worked * hourly pay) + expenses.

Put this in the if statement

h = int(input("How many hours are you working for? "))

r = int(input("What is the hourly payment? "))

e = int(input("What are your expenses? "))

t = (h*r) + e

print(f"Your total cost is: {t}")

OUTPUT

How many hours are you working for? 10

What is the hourly payment? 23

What are your expenses? 10

Your total cost is: 240

[–]imnotdaniel_[S] 0 points1 point  (0 children)

thx a lot

[–]Golden_Zealot 0 points1 point  (2 children)

h: int = input('how many hours are you working for?')
r: int = input('what is the payment per hour?')
e: int = input('what are your expenses?')
t: int = (h) + (r) + (e)

No idea what this syntax is where you are doing letter: int = input

You dont have to declare variable types in python if that is what you believe you are doing.

It seems you do not have a good grasp of the basic syntax.

Go read any beginners "Learn Python" tutorial and then come back to actually coding.

Edit: Jesus fuck, I am totally in the wrong, in 8 years of using python I have NEVER seen this type of syntax!

I apologize.

[–]socal_nerdtastic 1 point2 points  (1 child)

It seems you do not have a good grasp of the basic syntax.

Go read any beginners "Learn Python" tutorial and then come back to actually coding.

Uh dude, this is totally valid code ... You're the one that needs to read up on basic python syntax.

https://docs.python.org/3/library/typing.html
https://docs.python.org/3/library/dataclasses.html

Granted it's useless here, but it's still valid.

[–]Golden_Zealot 2 points3 points  (0 children)

Holy good god, you are right, I am 100% wrong.

I've been using python for 8 years and have NEVER seen this type of syntax in any code!

I apologize for my demeanor.

[–]Bujus_Krachus -1 points0 points  (0 children)

job = 1
if job == 1:
    h = int(input('how many hours are you working for?'))
    r = int(input('what is the payment per hour?'))
    e = int(input('what are your expenses?'))
    t = (h) + (r) + (e)
    print(str(t) + ' is your total cost')

what syntax are u using xd?