Python Forum
Would you prefer two 'if' statements or an 'if' and an 'else' statement?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Would you prefer two 'if' statements or an 'if' and an 'else' statement?
#1
from tkinter import *
import tkinter.messagebox

root = Tk()

tkinter.messagebox.showinfo("This is the window title!","This is some important info!")
answer = tkinter.messagebox.askquestion("What a dumb box!","Do you want this dumb little window to go away?")

if answer =='yes':
    print("Hell Yes!")
if answer =='no':
    print("I am not ready to go!")

root.mainloop()
When you look at this code, do you prefer it with two 'if' statements or an 'if' and an 'else' statement?
Reply


Messages In This Thread
Would you prefer two 'if' statements or an 'if' and an 'else' statement? - by AnunnakiKungFu - Dec-09-2020, 10:46 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  SyntaxError: multiple statements found while compiling a single statement Kayode_Odeyinka 1 3,011 Mar-12-2020, 05:50 PM
Last Post: micseydel
  SyntaxError: multiple statements found while compiling a single statement DragonG 1 5,486 Nov-26-2018, 05:33 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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