Python Forum
Thread Rating:
  • 3 Vote(s) - 3.33 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"if" beginner question
#8
Some observations:

input() is more readable and concise when used with argument:

>>> first = input('Choose the first one: ')
Choose the first one: 
In order to get spaces between choices you don't need to enter empty strings. Same result can be achieved by adding space at the end of string or writing it in one string with double spaces:

>>> print("milk", "", "sugar", "", "tea", "", "coffee")
milk  sugar  tea  coffee
>>> print('milk ', 'sugar ', 'tea ', 'coffee')
milk  sugar  tea  coffee
>>> print('milk  sugar  tea  coffee')
milk  sugar  tea  coffee
 
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
"if" beginner question - by Naito - Jan-12-2019, 06:58 AM
RE: "if" beginner question - by Mr_W - Jan-12-2019, 01:07 PM
RE: "if" beginner question - by Trinx - Jan-12-2019, 05:08 PM
RE: "if" beginner question - by buran - Jan-12-2019, 05:10 PM
RE: "if" beginner question - by Trinx - Jan-12-2019, 05:13 PM
RE: "if" beginner question - by Trinx - Jan-12-2019, 10:43 PM
RE: "if" beginner question - by Naito - Jan-13-2019, 09:22 AM
RE: "if" beginner question - by perfringo - Jan-13-2019, 11:04 AM
RE: "if" beginner question - by Naito - Jan-13-2019, 12:51 PM
RE: "if" beginner question - by buran - Jan-13-2019, 12:57 PM
RE: "if" beginner question - by Mr_W - Jan-13-2019, 01:01 PM
RE: "if" beginner question - by Naito - Jan-13-2019, 01:12 PM
RE: "if" beginner question - by metulburr - Jan-13-2019, 01:31 PM
RE: "if" beginner question - by perfringo - Jan-13-2019, 02:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Very Beginner question on simple variables Harvy 1 350 Apr-12-2024, 12:03 AM
Last Post: deanhystad
  A simple "If...Else" question from a beginner Serena2022 6 1,854 Jul-11-2022, 05:59 AM
Last Post: Serena2022
Question Beginner Boolean question [Guessing game] TKB 4 2,488 Mar-22-2022, 05:34 PM
Last Post: deanhystad
  Beginner question NameError amazing_python 6 2,649 Aug-13-2021, 07:28 AM
Last Post: amazing_python
  Beginner question - storing values cybertron2 4 3,359 Mar-09-2021, 04:21 AM
Last Post: deanhystad
  beginner question about lists and functions sudonym3 5 2,903 Oct-17-2020, 12:31 AM
Last Post: perfringo
  beginner question ___ 1 1,803 Jul-12-2020, 08:12 AM
Last Post: Gribouillis
  Beginner question: lxml's findall in an xml namespace aecklers 0 3,006 Jan-22-2020, 10:53 AM
Last Post: aecklers
  Super easy beginner question AkulaLA 3 3,406 Nov-07-2019, 03:42 AM
Last Post: Larz60+
  Basic Beginner question NHeav 4 2,930 Sep-13-2019, 11:43 AM
Last Post: NHeav

Forum Jump:

User Panel Messages

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