Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4240954
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:14:14+00:00 2026-05-21T03:14:14+00:00

I have the following codes: if date in (start, end): print(‘in between’) else: print(‘No!’)

  • 0

I have the following codes:

if date in (start, end):
        print('in between')
else:
        print('No!')

date, start and end are all variables with the format of 1/1. What should I do to have it print out the right result? i tried date as 10/2, start as 3/14 and end as 11/7 and it’s print ‘No!’, which means it’s not running right. I guess have to format them to a date format and then compare them.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T03:14:15+00:00Added an answer on May 21, 2026 at 3:14 am

    As you are still not satisfied, I have another answer for you. Without using datetime and year.

    It just uses built-in tuples and comparing them:

    d1 = (3, 28)
    d2 = (3, 31)
    d3 = (4, 2)
    if d1 < d2 < d3:
        print("BETWEEN!")
    else:
        print("NOT!")
    

    You can create tuple like these easily:

    day = 16
    month = 4
    d = (month, day)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have the following code def get(self): date = datetime.date.today() loc_query = Location.all() last_cursor
I have the following method that retrieves all the appointments between 2 dates: def
I have the following code: [ [NSDate date] descriptionWithLocale: @yyyy-MM-dd ] I want it
I have following code class User attr_accessor :name end u = User.new u.name =
I have defined objects in js as following var newevent = {title: txt, start:
So I have this array: $dates[0] = array('start'=>'2010-07-22', 'end'=>'2010-07-23'); $dates[1] = array('start'=>'2010-07-22', 'end'=>'0000-00-00'); $dates[2]
I have two input dates taking from Date Picker control. I have selected start
All, I have the following code: $fetch = mysql_query(SELECT * FROM calendar_events where event_status='booked'
I have the following code that will count the elapsed time and print the
I have following Model t.string name t.date start_at t.date end_at t.datetime created_at t.datetime updated_at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.