Find the best answers to your questions with the help of IDNLearn.com's expert contributors. Join our community to receive prompt and reliable responses to your questions from knowledgeable professionals.
Sagot :
Answer:
See below.
Explanation:
To learn python programming language, first, you have to know the basic. Surely, you may recognize this function namely print()
print(“Hello, World!”) — output as Hello, World!
First, start with familiarizing yourself with basic function such as print. Then step up with arithmetic and declare or assign variable then list.
Here are example of functions:
1.) print(argument) — If argument is a string (word-typed), make sure to use “” or ‘’ or else it’ll output an error and say the argument is not defined.
print(“Hi, Brainly”) will output Hi, Brainly
print(2+3) will output 5
Numerical data or numbers do not necessarily require “ “ or ‘ ‘
print(3+3) will output 6 but print(“3+3”) will output 3+3 which is now a string.
2.) type(argument) - this tells you which data/argument it is. There are
- < class ‘str’ > which is string, meaning it contains “ “ or ‘ ‘
- < class ‘int’ > which is integer
- < class ‘float’ > which is decimal (20.0 is also considered as float, basically anything that contains decimal is all float type)
- < class ‘list’ > which is a list. List is something that contains elements within square brackets [ ]
etc.
Make sure you also do print(type(argument)) as well so it will print out the output.
3.) Arithmetic
- + is addition
Ex. print(1+3) will output 4
2. - is subtraction
Ex. print(5-4) will output 1
3. * is multiply
Ex. print(4*5) will output 20
4. ** is exponent
Ex. print(5**2) will output 25
5. / is division
Ex. print(6/3) will output 2 — sometimes will output the float type 2.0
6. % is modulo or remainder
Ex. print(7%2) will output 1
4.) Variables
To assign a variable, use =
An example is:
x = 2
y = 5
print(x+y) will output 7
print(type(x)) will output the < class ‘int’ >
These are examples of what you’ll learn in basic of python - remember, programming depends on experience and always focus on it. Keep practicing and searching will improve your skill at python.
We greatly appreciate every question and answer you provide. Keep engaging and finding the best solutions. This community is the perfect place to learn and grow together. For dependable answers, trust IDNLearn.com. Thank you for visiting, and we look forward to assisting you again.