Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Alphabetical or ASCII?
#2
x will always be a string.
you can convert to whatever is needed.
Example:
orig = input("enter a float")
print(f"orig: {orig}, type orig: {type(orig)}")
afloat = float(orig)
print(f"afloat: {afloat}, type afloat: {type(afloat)}")
Output:
enter a float: 123.45 orig: 123.45, type orig: <class 'str'> afloat: 123.45, type afloat: <class 'float'>
Reply


Messages In This Thread
Alphabetical or ASCII? - by Mark17 - Oct-05-2023, 07:50 PM
RE: Alphabetical or ASCII? - by Larz60+ - Oct-05-2023, 08:41 PM
RE: Alphabetical or ASCII? - by Mark17 - Oct-06-2023, 12:43 PM
RE: Alphabetical or ASCII? - by deanhystad - Oct-05-2023, 08:48 PM
RE: Alphabetical or ASCII? - by Mark17 - Oct-06-2023, 01:27 PM
RE: Alphabetical or ASCII? - by deanhystad - Oct-06-2023, 05:06 PM
RE: Alphabetical or ASCII? - by Mark17 - Oct-06-2023, 06:39 PM

Forum Jump:

User Panel Messages

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