Skip to main content
deleted 3 characters in body; edited body
Source Link
ovs
  • 60.6k
  • 3
  • 47
  • 161

Python 3.6, 96 9391 (9593-2) bytes

a,b=0,1
f=open(__file__,"r+");next(f);f.write(f"a,b={b,a+b}\n{next(f)}{f.‌​seekseek(0)}");print(b)

hardcoding the filename would save 5 bytes (9088 bytes):

a,b=0,1
f=open("f","r+");next(f);f.write(f"a,b={b,a+b}\n{next(f)}{f.‌​seekseek(0)}");print(b)

Saved some bytes thanks to @Artyer

Python 3.6, 96 93 (95-2) bytes

a,b=0,1
f=open(__file__,"r+");next(f);f.write(f"a,b={b,a+b}\n{next(f)}{f.‌​seek(0)}");print(b)

hardcoding the filename would save 5 bytes (90 bytes):

a,b=0,1
f=open("f","r+");next(f);f.write(f"a,b={b,a+b}\n{next(f)}{f.‌​seek(0)}");print(b)

Saved some bytes thanks to @Artyer

Python 3.6, 96 91 (93-2) bytes

a,b=0,1
f=open(__file__,"r+");next(f);f.write(f"a,b={b,a+b}\n{next(f)}{f.seek(0)}");print(b)

hardcoding the filename would save 5 bytes (88 bytes):

a,b=0,1
f=open("f","r+");next(f);f.write(f"a,b={b,a+b}\n{next(f)}{f.seek(0)}");print(b)

Saved some bytes thanks to @Artyer

added 38 characters in body
Source Link
ovs
  • 60.6k
  • 3
  • 47
  • 161

Python 3.6, 96 9493 (9695-2) bytes

a,b=0,1
f=open(__file__,"r+");s=f.readlines()[1];f.seek;next(0f);f.write(f"a,b={b,a+b}\n"+s\n{next(f)}{f.‌​seek(0)}");print(b)

hardcoding the filename would save 5 bytes (9190 bytes):

a,b=0,1
f=open("f","r+");s=f.readlines()[1];f.seek;next(0f);f.write(f"a,b={b,a+b}\n"+s\n{next(f)}{f.‌​seek(0)}");print(b)

Saved some bytes thanks to @Artyer

Python 3.6, 96 94 (96-2) bytes

a,b=0,1
f=open(__file__,"r+");s=f.readlines()[1];f.seek(0);f.write(f"a,b={b,a+b}\n"+s);print(b)

hardcoding the filename would save 5 bytes (91 bytes):

a,b=0,1
f=open("f","r+");s=f.readlines()[1];f.seek(0);f.write(f"a,b={b,a+b}\n"+s);print(b)

Python 3.6, 96 93 (95-2) bytes

a,b=0,1
f=open(__file__,"r+");next(f);f.write(f"a,b={b,a+b}\n{next(f)}{f.‌​seek(0)}");print(b)

hardcoding the filename would save 5 bytes (90 bytes):

a,b=0,1
f=open("f","r+");next(f);f.write(f"a,b={b,a+b}\n{next(f)}{f.‌​seek(0)}");print(b)

Saved some bytes thanks to @Artyer

added 163 characters in body
Source Link
ovs
  • 60.6k
  • 3
  • 47
  • 161

Python 3.6, 96 94 (96-2) bytes

a,b=0,1
f=open(__file__,"r+");s=f.readlines()[1];f.seek(0);f.write(f"a,b={b,a+b}\n"+s);print(b)

hardcoding the filename would save 5 bytes (91 bytes):

a,b=0,1
f=open("f","r+");s=f.readlines()[1];f.seek(0);f.write(f"a,b={b,a+b}\n"+s);print(b)

Python 3.6, 96 94 (96-2) bytes

a,b=0,1
f=open(__file__,"r+");s=f.readlines()[1];f.seek(0);f.write(f"a,b={b,a+b}\n"+s);print(b)

Python 3.6, 96 94 (96-2) bytes

a,b=0,1
f=open(__file__,"r+");s=f.readlines()[1];f.seek(0);f.write(f"a,b={b,a+b}\n"+s);print(b)

hardcoding the filename would save 5 bytes (91 bytes):

a,b=0,1
f=open("f","r+");s=f.readlines()[1];f.seek(0);f.write(f"a,b={b,a+b}\n"+s);print(b)
added 10 characters in body
Source Link
ovs
  • 60.6k
  • 3
  • 47
  • 161
Loading
Source Link
ovs
  • 60.6k
  • 3
  • 47
  • 161
Loading