Adblock breaks this site

Need help coding python dutch

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

  1. Hichamelcuz

    Hichamelcuz Member

    Joined:
    Dec 11, 2019
    Posts:
    80
    Referrals:
    0
    Sythe Gold:
    69
    Vouch Thread:
    Click Here
    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.
  2. MakiseKurisu

    MakiseKurisu Active Member

    Joined:
    Apr 14, 2020
    Posts:
    200
    Referrals:
    0
    Sythe Gold:
    220
    Discord Unique ID:
    698515954627248188
    Discord Username:
    Makise#3800
  3. Zeus

    Zeus Discord Bot Developer
    $200 USD Donor New

    Joined:
    Mar 27, 2019
    Posts:
    1,287
    Referrals:
    3
    Sythe Gold:
    1,812
    Discord Unique ID:
    949810973512986654
    Discord Username:
    ronaldo_19
    Heidy Two Factor Authentication User Sythe's 15th Anniversary Nitro Booster (2) Hoover
    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
  4. Hichamelcuz

    Hichamelcuz Member

    Joined:
    Dec 11, 2019
    Posts:
    80
    Referrals:
    0
    Sythe Gold:
    69
    Vouch Thread:
    Click Here
    Need help coding python dutch

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


 
 
Adblock breaks this site