Learn to Code via Tutorials on Repl.it!

← Back to all posts
3 quick tips to help you code a little more efficiently
AustinZhang1

HELLO EVERYBODY

This is a tutorial on how to code a little more efficiently in Python.


TIP #1

Have you ever forgotten to put quotations/parentheses around a string? Well here is a tip to save you a few seconds. Double click/highlight the text that you want to put quotations around, then just press the ' or " or ( key and the highlighted text will have quotations/parentheses around it!


TIP #2

Have you ever made a bunch of functions with attributes, but when you needed to add another attribute, it took forever to change all of the functions? Well, there are two solutions to this problem.

SOLUTION A:

It is possible to have Multiple Cursors in Repl. Click where you want to edit the text, then use Control + Click and click where you want to add the second cursor. Then, when you type something, all cursors will respond, typing the same thing in multiple places

SOLUTION B:

The second solution is that you can use Ctrl + H to open up a find & replace bar. On the top, paste in the code you want to replace, and on the bottom input the code that you want to replace it with. You can now replace everything easily.


TIP #3

This is a quicker way to write your import statements: instead of writing

You can use:

which can save you from typing a few lines of code.


TIP #4

Have you ever had to indent a lot of code? You can indent a large block of code by highlighting all of it, then pressing Tab(to indent) or Shift + Tab(to unindent).


I hope this little tutorial helps you code a little bit more efficiently. Please consider upvoting!

Voters
badsport
AustinZhang1
Comments
hotnewtop
JohnDGomez

Hi, I am looking for these 3 quick tips to help you code a little more efficiently for a very long. And I am happy that I found your post. I was reading edubirdie review online and while reading them I have found your post. I am a college student and I want to submit my essay assignment. But I don't have time to search for it because I am busy arranging a wedding plan for my brother. He is getting married and he gave me all the duties. Because of this, I don't have time to write my essay assignments. My course is C++ and that is why I always gather information online regarding C++.

CodeLongAndPros
  1. Ok
  2. REGEX
  3. Not as readable
AustinZhang1

@CodeLongAndPros I am confused please explain further

CodeLongAndPros

@AustinZhang1
#1 is a valid tip
#2: Regex search-and-replace is much faster:
If you have

and you want to change them to _foo_2, _bar_2, and _floo_2, you can use:
Search:

replace:

#3 is hard to read. You don't do #include<stdio.h stdbool.h).

AustinZhang1

@CodeLongAndPros what is #include<stdio.h stdbool.h)?

CodeLongAndPros

@AustinZhang1 C preprocesser directives, like import