Skip to content
  • Categories
  • Recent
  • Groups
  • Users
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Zephyr)
  • No Skin
Collapse
Brand Logo
Links

Links

@Links
Clown 🤡 Pythons the goat Nintendo Switch Users Eeveelution Fan! Brazilian pepsi lovers meggy lovers NOCTURNAL Smash Ultimate straight allies!
Unfollow Follow
About
Posts
71
Topics
5
Shares
0
Groups
12
Followers
11
Following
8
Medals

Posts

Recent Best Controversial

  • who is your favourite browsedns user
    Links Links
    General it better be me or else

    @Apollo.Is.Silly @Beerus


  • Help Wanted
    Links Links
    Web Development

    Hi! I kinda wanna try to make a social network... any willing?


  • Y'know what they say!
    Links Links
    General

    @SupearMan Y TF IS SANS IN THERE???? 😨 😨


  • can someone give me some tips on how to make Python programs that write data to external files?
    Links Links
    Web Development

    @danniltrifonov Yeah and chat gpt cant even write code. it can just correct code


  • can someone give me some tips on how to make Python programs that write data to external files?
    Links Links
    Web Development

    @Andyboi yeah actually but he sometimes is outdated so its better to just check the forms


  • can someone give me some tips on how to make Python programs that write data to external files?
    Links Links
    Web Development

    @danniltrifonov You're welcome!


  • can someone give me some tips on how to make Python programs that write data to external files?
    Links Links
    Web Development

    Hope it worked :)


  • can someone give me some tips on how to make Python programs that write data to external files?
    Links Links
    Web Development

    1. Wrong logic in is_minor()

    You wrote:

    if age > 18:
        is_minor = True
    else:
        is_minor = False
    

    This means someone over 18 is considered a minor, which is backwards.
    It should be:

    if age < 18:
        is_minor = True
    else:
        is_minor = False
    

    Or even shorter:

    return age < 18
    

    2. Missing parenthesis in file.write()

    In write_to_file():

    file.write(name + ", "
    

    You forgot the closing ) for that file.write call.


    3. Writing a boolean directly to a file

    file.write() needs a string.
    You’re trying to write:

    file.write(minor)
    

    But minor is a boolean (True or False). You must convert it to string:

    file.write(str(minor))
    

    4. You’re opening the file with r+

    r+ means read/write without truncating. If the file doesn’t exist, it will throw an error. If you just want to append, use "a" or "a+". If you want to overwrite, use "w".


    Fixed Code

    Here’s a working version:

    # Open in append mode
    file = open("database.txt", "a")
    
    name = input("Enter your name: ")
    age = int(input("Enter your age: "))
    
    def is_minor(age):
        return age < 18
    
    minor = is_minor(age)
    
    def write_to_file(name, age, file, minor):
        file.write(name + ", ")
        file.write(str(age) + ", ")
        file.write(str(minor) + "\n")
    
    write_to_file(name, age, file, minor)
    file.close()
    

  • 🤡
    Links Links
    General

    Do you ever miss just joking around? clowning on people or just having a gang?? Well look no further than this:

    The Party_Clowns!
    we (by wich i mean me) are a group of people who just wanna break free from hours of boredom and start doing stupid stupidity around! of course we won't break any rules and such but we will have lots of fun.

    This is NOT against the rules since this is small advertising and not spammed or botted.


  • Act along the thing
    Links Links
    General

    @lewcyyi NO ITS NOT GET BACK HERE


  • Act along the thing
    Links Links
    General

    @Beerus lol i used to hav lots of weird pets


  • Act along the thing
    Links Links
    General

    never actually did the deed but he hurted them a lot


  • Act along the thing
    Links Links
    General

    @Apollo.Is.Silly yeah he kinda did. he used to hump small puppies


  • Act along the thing
    Links Links
    General

    @Links (no joke)


  • Act along the thing
    Links Links
    General

    @Apollo.Is.Silly he died in a car acident after drinking my dad's beer that fell on the floor :((


  • Act along the thing
    Links Links
    General

    @Apollo.Is.Silly dang i had a pet golden retriever


  • Act along the thing
    Links Links
    General

    YOU KNOW WHAT IMMA JOIN YOU (^v^)

    BARK BARK!! Runs after tail


  • Act along the thing
    Links Links
    General

    AHHGHH NARR MY PLAN FAILED SINCE UR TOO BELOVED TO BE PRANKEDDDD :(


  • Act along the thing
    Links Links
    General

    DROP ON UR KNEES AND BARK LIKE U WANT IT (lol)

  • 1
  • 2
  • 3
  • 4
  • 3 / 4
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Groups
  • Users
  • Tags
  • Popular