29th Oct 2022, 2:36 AM
Vive MX
Vive MX - avatar
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)
29th Oct 2022, 5:25 AM
Per Bratthammar
Per Bratthammar - avatar
+ 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
29th Oct 2022, 4:17 AM
Sandeep
Sandeep - avatar
+ 3
Vive MX edit the question and mention the code link in "description" section. It will link your code with your question.
29th Oct 2022, 3:46 AM
Sandeep
Sandeep - avatar
+ 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.
29th Oct 2022, 3:58 AM
Sandeep
Sandeep - avatar
+ 3
Vive MX can you tell me what error are you getting? Your code is working fine.
29th Oct 2022, 3:58 AM
Sandeep
Sandeep - avatar
+ 2
''' Per Bratthammar , You forgot to add it. ''' operator=operator.strip()
29th Oct 2022, 9:41 AM
SoloProg
SoloProg - avatar
0
Code is too long in the link
29th Oct 2022, 3:12 AM
Vive MX
Vive MX - avatar
0
Copy text and then search it
29th Oct 2022, 3:15 AM
Vive MX
Vive MX - avatar
0
👍👍ok
29th Oct 2022, 3:48 AM
Vive MX
Vive MX - avatar
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")
30th Oct 2022, 12:03 PM
ahmed omer
ahmed omer - avatar
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 🙂😉
30th Oct 2022, 12:07 PM
ahmed omer
ahmed omer - avatar
0
Bro take int(input())
31st Oct 2022, 2:19 AM
ankith patel
ankith patel - avatar