Need help coding python dutch

Discussion in 'Homework Help' started by Hichamelcuz, Jun 23, 2020.

Need help coding python dutch
  1. Unread #1 - Jun 23, 2020 at 7:32 PM
  2. Hichamelcuz
    Joined:
    Dec 11, 2019
    Posts:
    80
    Referrals:
    0
    Sythe Gold:
    69
    Vouch Thread:
    Click Here

    Hichamelcuz Member

    Need help coding python dutch

    I need to code something in Python for school, which if someone would say there name and what year there birthday it is, it will say hey ... you have been alive for ... venusyears, how much would someone want to do this for me? Need it done good..
     
    ^ MAGZ likes this.
  3. Unread #2 - Jun 24, 2020 at 2:00 AM
  4. MakiseKurisu
    Joined:
    Apr 14, 2020
    Posts:
    200
    Referrals:
    0
    Sythe Gold:
    220
    Discord Unique ID:
    698515954627248188
    Discord Username:
    Makise#3800

    MakiseKurisu Active Member

  5. Unread #3 - Jun 24, 2020 at 3:50 PM
  6. Zeus
    Joined:
    Mar 27, 2019
    Posts:
    1,279
    Referrals:
    3
    Sythe Gold:
    1,804
    Discord Unique ID:
    295410796370984970
    Discord Username:
    ZeusS#5241
    Heidy Two Factor Authentication User Sythe's 15th Anniversary Nitro Booster (2) Hoover

    Zeus Discord Bot Developer
    $200 USD Donor New

    Need help coding python dutch

    Code:
    #Assuming this is a venus year : https://www.universetoday.com/47900/length-of-year-on-venus/
    from datetime import datetime
    import sys
    def get_venus_year(earth_years : int):
        return round( (earth_years * 365)/225, 2)
    
    #Take input from user
    _name = input("Please Enter your Name: ")
    try:
        _yob = int(input("Please Enter your Birthyear (ex, 1970): "))
    except ValueError:
        print("Please enter your birth year in correct format")
        #exit the program if invalid input is passed. You could add more checks around this so that a user cannot enter a birthyear >= current year
        sys.exit()
    
    #get current year   
    _cur_year = datetime.now().year
    #calculate age (in years). This assumes that your birthday has already passed this year.
    _earth_years = _cur_year - _yob
    
    print(f"Hey {_name}, you have been alive for {get_venus_year(_earth_years)} venus years")
    
    Might need some more tweaks but this would be the basic idea.
     
    Last edited: Jun 24, 2020
  7. Unread #4 - Jun 24, 2020 at 7:09 PM
  8. Hichamelcuz
    Joined:
    Dec 11, 2019
    Posts:
    80
    Referrals:
    0
    Sythe Gold:
    69
    Vouch Thread:
    Click Here

    Hichamelcuz Member

    Need help coding python dutch

    Wooow thank you a lot bro
     
    ^ Zeus likes this.
< Computer Science and General Programming Service | Closed >

Users viewing this thread
1 guest


 
 
Adblock breaks this site