Ask coding questions

← Back to all posts
hi im new at python

can anyone help me? if you guys help me that good!

Answered by RyanRana (184) [earned 5 cycles]
View Answer
Commentshotnewtop
RyanRana (184)

Do you want to learn python? You can check out my programming youtube channel https://www.youtube.com/channel/UCIta8OqsKjfE1knTU2DJlSQ?disable_polymer=true. Python Intermediate, Beginner, and Advanced content. Please subscribe if you like it.

Or, do you need help with code, just copy and paste below if you need that.

ThanhTungTung (1)

@RyanRana , thank, your youtube channel was great, i sub it

RyanRana (184)

@ThanhTungTung Thanks, so much. Really appreciate it!

JonathanDavis3 (0)

CS1301 course helped alot

JonathanDavis3 (0)

YatinBayya, you missed the fact, that there is elif, that goes before else and after if

ThanhTungTung (1)

thank everyone again

ThanhTungTung (1)

thankkkkkkkkkkkkk so much for helping me

YatinBayya (18)

The Basics
This is an overview of the basics to help you boost your start with python. I won't go through everything of course but enough for you to start your first application. Make sure you selected Python 3 instead of Python 2.
Variables
Variables in python are just like the ones in math but you have to define them. You can store different types of data like the ones below...
Booleans - True/False
Strings- Text
Int/Integer - Numbers with no decimal
Double - Decimals
Long - Big Number
Short - Small Number
Byte- 0-8
This is how we define each one

``````var myBoolean = True
var myString = "A String"
var myInt= -34
var myDouble= 43.143
var myShort = 10
var myLong =34123
var myByte = 2``````

The variable names are in the middle which you will need to call it... and you can name the variables anything without any special characters(!, +, #, etc)
Note: True/False in booleans MUST be capitalized
Operators
Operators is math. Done! Ok, here are the different types...
Addition - +(It adds stuff)
Subtraction- - (It subtracts stuff)
Multiplication- is the star above the 8 key (It multiplies stuff)
Division- / (It divides stuff)
*Modulus- % (It finds the remainder of an equation)
Here is the syntax

``````var mathNumber = 42
var password = 1234

var addition = mathNumber+password

print(password%mathNumber)``````

As you can see my very AP math skills
Print Statements
The print statement is a very simple concept, all it does is display text in the terminal/console. In replit, you should see your program running on the side. Below is the syntax of the code for printing.

``print("Hello World")``

Whatever is in the quotes is printed so you can change it to "Creeper Aww Man" and it would work. We can also print variables like this (only if we have it defined)...

``print(myInt)``

To print variables along strings you can do...

``print("My Name is" + name)``

Input
Say you want to print What is your Name? and then print the user's name. To do this you would need to tell the computer you are getting there input.

``name = input("What is your name?")``

The code here makes a variable which you can use later to print or do something.
Note: the thing before the = sign is your variable name for pulling the data later.
If/Else Statements
What do we do when we want to check if data is equal to something... well if statements. This is the syntax to make if statements are...

``````if(age > 60):
print("Sign Up for our senior program)
else if(age == 9):
print("Greetings 9-year-old")
else:
print("Hello"+age+"year-old")``````

Note: Indentations (press tab key, NO SPACES) are REALLY important for the syntax. If it is wrong you program will crash. This is only when the line before has ":" which means it continues to the next line so you need to indent the things you want to execute when that statement is true.
Conclusion
This is a very small part of the programming world but I found some tutorials I think would help you out with your python coding.

ThanhTungTung (1)

hi @YatinBayya ,wow, you know lot about code, thank you

YatinBayya (18)

@ThanhTungTung Your welcome. I am glad it helped it took me an hour to write it

YatinBayya (18)

@ThanhTungTung My bad there is no else if there is only elif.

ChristopherLi5 (11)

Coding in Python? I suggest you either read a Python book or go to codecademy.com and take a Python course. After you know some Python, I suggest you could make some mini projects.

ThanhTungTung (1)

hi @ChristopherLi5 , thank for helping me, it very useful at codecademy.com

Masy (26)

Yeah, If you could post a code snippet, that would be helpful! :)

ThanhTungTung (1)

@Masy , thank very much, if have any problem, i will ask you guys

Zavexeon (739)

Can we get some context? ^w^

If you're struggling with code add a snippet of it, please. We'd be happy to help. :)

ThanhTungTung (1)

@Zavexeon , thank very much, if have any problem, i will ask you guys