Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie needs help
#4
There are many ways to format output in python. Below are f"strings (preferred) and .format() (older and being replaced by f"strings. Hopefully this is enough to show how you can format your output string.
print(f"{car} {year} {mile}")
print(f"{} {} {}".format(car, year, mile))

Before you start using year or mile as numbers, you'll need to convert them to numbers. For that you'll be using int() and float(). You should also investigate try and except. Inevitably you will enter something that is not a number, and your program will raise a "ValueError" and crash.
dvejsa likes this post
Reply


Messages In This Thread
Newbie needs help - by dvejsa - Sep-06-2022, 07:09 PM
RE: Newbie needs help - by XavierPlatinum - Sep-06-2022, 07:26 PM
RE: Newbie needs help - by dvejsa - Sep-06-2022, 07:37 PM
RE: Newbie needs help - by deanhystad - Sep-06-2022, 07:42 PM
RE: Newbie needs help - by Yoriz - Sep-06-2022, 07:46 PM
RE: Newbie needs help - by dvejsa - Sep-06-2022, 07:51 PM

Forum Jump:

User Panel Messages

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