Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Repr() function
#1
Hello! I am a Junior in Python. I am doing my first steps.
Please help with repr(function).
I read in Python book that repr() must return "real" meaning.
For example (from book):
>>> num = 1 / 3
>>> repr(num)#
‘0.33333333333333331’
>>> str(num) #
‘0.333333333333’

I tried to use repr() in Sublime Text Editor and in interactive python mode/ But result is same. I receive only 0.333333333333, but never ‘0.33333333333333331’.
I use Python 3.7.2 ver.
[Image: 73fd8a7309c0.jpg]
[Image: 36b89161a1a0.jpg]

Thank you very much for support!
Valentina!
Reply


Messages In This Thread
Repr() function - by Valentina - Aug-19-2019, 01:28 PM
RE: Repr() function - by fishhook - Aug-19-2019, 01:50 PM
RE: Repr() function - by Valentina - Aug-22-2019, 11:13 AM
RE: Repr() function - by perfringo - Aug-22-2019, 11:28 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  ascii() (repr() in py2) Skaperen 1 3,935 Jun-05-2017, 10:32 PM
Last Post: Ofnuts
  str vs repr Skaperen 9 6,009 Jun-05-2017, 01:04 AM
Last Post: Skaperen
  when repr() fails Skaperen 8 6,658 May-03-2017, 02:48 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

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