+ 2
What is the eror.
12 odpowiedzi
+ 6
# Hi, Vive MX !
# You should be able to input floats, not only integers,
# in this type of program:
first = float(first)
second = float(second)
+ 5
Vive MX you might be getting errors because of not passing inputs correctly
you need to pass values in separate line when passing inputs
You need to do:
6
//
4
(each value is on separate line)
instead of:
6 // 4
Please mention if there is some other error
+ 3
Vive MX edit the question and mention the code link in "description" section.
It will link your code with your question.
+ 3
Vive MX
Also, remove the code link from "question title" and mention your problem/query. Doing this will help us understand your question better.
+ 3
Vive MX can you tell me what error are you getting? Your code is working fine.
+ 2
'''
Per Bratthammar ,
You forgot to add it.
'''
operator=operator.strip()
0
Code is too long in the link
0
Copy text and then search it
0
👍👍ok
0
first=int(input("enter first num :"))
second=int(input("enter second num :"))
op=input("enter operator(+,-,*,%,/,//,**) : ")
if operator=="+":
print (first+second)
elif operator=="-":
print (first-second)
elif operator=="*":
print (first*second)
elif operator=="/":
print (first/second)
elif operator=="//":
print (first//second)
elif operator=="%":
print (first%second)
else:
print ("invalid operation")
0
Am sorry i comment in another comment here the the code fixed and it work just fine.
You just defined the first and second two times which mean you had override when you defined at the first time...hope you the best 🙂😉
0
Bro take int(input())