Python Forum
Calculator I need quick help
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calculator I need quick help
#4
Can the numbers be entered as decimal?
Czy liczby można wprowadzić ad decimal?
Przykład Binarnym : 5 - 4

Or do you need to enter them in the number system of the output?
Czy trzeba wprowadzić je w systemie liczbowym wyjścia?
Przykład Binarnym : 0b101 - 0b100

If you can enter the numbers in decimal, this code will work.
Jeśli można wprowadzić liczby w liczbie dziesiętnej, ten kod będzie działać.

pierwsz = input (' Podaj pierwsza liczbei : ')
operator = input ('EWprowadź operatora  (+, -, *, /) : ')
Drugi = input (' Wprowadź drugi numer : ')
Odpowiedź = eval (f'{pierwsz} {operator} {Drugi}')
print (Odpowiedź)
print (bin (Odpowiedź))
print (oct (Odpowiedź))
print (hex (Odpowiedź))
Reply


Messages In This Thread
Calculator I need quick help - by Malin3k - Feb-12-2021, 11:02 AM
RE: Calculator I need quick help - by buran - Feb-12-2021, 01:48 PM
RE: Calculator I need quick help - by jefsummers - Feb-12-2021, 11:53 PM
RE: Calculator I need quick help - by BashBedlam - Feb-13-2021, 02:10 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020