Python Forum
Thread Rating:
  • 3 Vote(s) - 3.33 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"if" beginner question
#14
If names x, y, z, t are not used anywhere else it can be expressed in more readable form:

>>> first = input("Choose the first one: ").lower()
>>> second = input("Choose the second one: ").lower()
>>> if first == 'milk' and second == 'tea':
...     print("????????????")
... elif first == 'milk' and second == 'coffee':
...     print("typical")
... elif first == 'sugar' and b == 'tea':
...     print("okay")
... elif first == 'sugar' and second == 'coffee':
...     print("wake up")
... else:
...     print("is there any other comb?")
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 167 Apr-12-2024, 12:03 AM
Last Post: deanhystad
  A simple "If...Else" question from a beginner Serena2022 6 1,700 Jul-11-2022, 05:59 AM
Last Post: Serena2022
Question Beginner Boolean question [Guessing game] TKB 4 2,295 Mar-22-2022, 05:34 PM
Last Post: deanhystad
  Beginner question NameError amazing_python 6 2,444 Aug-13-2021, 07:28 AM
Last Post: amazing_python
  Beginner question - storing values cybertron2 4 3,194 Mar-09-2021, 04:21 AM
Last Post: deanhystad
  beginner question about lists and functions sudonym3 5 2,724 Oct-17-2020, 12:31 AM
Last Post: perfringo
  beginner question ___ 1 1,729 Jul-12-2020, 08:12 AM
Last Post: Gribouillis
  Beginner question: lxml's findall in an xml namespace aecklers 0 2,905 Jan-22-2020, 10:53 AM
Last Post: aecklers
  Super easy beginner question AkulaLA 3 3,246 Nov-07-2019, 03:42 AM
Last Post: Larz60+
  Basic Beginner question NHeav 4 2,753 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