Software programing
Kanalga Telegram’da o‘tish
This is a channel which gives tutorial on different programming languages, android tips and tricks best apps etc...
Ko'proq ko'rsatish1 471
Obunachilar
Ma'lumot yo'q24 soatlar
Ma'lumot yo'q7 kun
Ma'lumot yo'q30 kun
Postlar arxiv
1 471
#18 python: a closer look at booleans
to know whether something gives out a True or False value, we use the in-build bool function. use later on in this post
bool(True)
>>> True
bool("abc")
>>> True
bool("")
>>> False
bool([9, 0])
>>> True
bool([ ])
>>> False
🧲 use of it
let us say you want to do something as long as there are elements in a list
nums = [2,2,9]
if nums:
#if list not empty
...
else:
#if list empty
...
1 471
#16 python: classes
👓 classes are a way to represent real world things. objects have attributes like colour, age, number of parts etc. objects also do actions like move.
📑 in programming classes is like a plan, like we describe how an object is
class Bus:
wheels = 4
color = "white"
def move(self):
print("moving")
now we create the actual object by
toyota_bus = Bus()
we can view attributes
print(toyota_bus.wheels)
>>> 4
toyota_bus.move()
>>> moving
1 471
4⃣JavaScript
❤️Love it or 🤮hate it, Javascript is one of the most popular languages for creating games.
✅ It naturally works well with
HTML and CSS and is well suited for online games.
✅ Javascript can be used on both the back end and front
end of web development and has a huge, helpful online
community as well as an enormous number of
frameworks.
✅ Javascript has proven to be an extremely versatile
language, and with the help of libraries can be used for
iOS and Android Apps, desktop apps, and on hardware.
With many free online tutorials and a massive GitHub presence,✅ Javascript is one of the easiest languages to
learn. It can also be used for scripting with Unity3D.
1 471
😱 Bëst 4 Game Programming Languages
1⃣ C++ ❤️
✅The pioneer of modern game programming languages, C++ adds the concept of (OOP) onto its predecessor Most high-end games that you play today depends on C++ codes in
one way or the other. Popular gaming consoles such as the ✅ Xbox and PlayStation both utilize this game programming language heavily.
✅C++ is the must-know language if you anticipate yourself developing futuristic games.
2⃣ Java 😍
✅Java runs on everything, from printers and microwaves to complex video game systems.
✅ It is a very dynamic language with lots of applications, making it seem like a good choice to learn.
🚻 Java is closely related to 👀C++, so learning the two alongside
each other would not be difficult.
3⃣C# 😎
✅ C# is another powerful language with a wide range of
applications. It is somewhat easier to pick up then C++
so it could be a better one to learn first.
✅Several factors make C# a great choice for creating
games. The first is its XNA framework, from Microsoft,
which makes it perfect for making games for Windows or
Xbox.
♓️The second is that is integral to game engines such as
the popular Unity3D and Xamarin. C# can be used to
make games on virtually any platform, including iOS,
Android, PlayStation, and Windows related software as
mentioned before.
🔅MonoGame can be used to distribute software over most
platforms, and this works well with C#. ✅This is one
language that opens doors and allows nearly any gamer
to enjoy your creation no matter what hardware they use.
1 471
#15 python: more on for loop
for loops can also be used to generate numbers
for i in range(5):
print(i)
>>>
0
1
2
3
4
it can be controled via
range(, , )
for i in range(1, 10, 2):
print(i)
>>>
1
3
5
7
9
1 471
# 14 python: for loops
for loops are more convenient
🛢 they can be used to go through lists
fruits = ["apple", "orange", "banana"]
for i in fruits:
print(i)
>>>
apple
orange
banana
👉 but the i above is just a variable name, it can be changed to fruit.
for fruit in fruits:
print(fruit)
1 471
#13 python: loops
loops go over and over again until you tell it to stop
💿 demo
stop = False
x = 0
while stop == False:
if x == 5:
stop = True
x += 1
the above program increases x each time but also checks if it equals 5, if so, it changes the condition
💿 breaking out
but you can also stop using the word break
x = 0
while True:
if x == 5:
break
x += 1
⚠ infinite loop
a while loop can go on inffinitely if the condition is not thoroughly checked
while True is an infinite loop
1 471
#12 python: parameters in functions
here is a function calculating sum
def sum():
return 1+2
but that's not useful what if we want 4 and 5?
that's why we add parameters
def sum(x, y):
return x+y
print(sum(4,5))
>>> 9
🌙 line example
def line(x):
m = 2
c = 3
return m*x + c
print(line(2))
>>> 7
🌙 without return
def fuzzy(s):
print(s*3)
fuzzy("ab")
>>> ababab
1 471
#11 python: functions
functions allow us to wrap in many lines of codes
print(1)
print(2)
print(3)
can be wrapped in
def print_all():
print(1)
print(2)
print(3)
so that when you do
print_all()
it will print
1
2
3
very convenient as you don't have to type those lines each time
🗝 the return keyword
return makes a function behave like a value when you return something
def something():
return 1
print(something())
>>> 1
these can be assigned to variables
x = something()
print(x)
>>>1
1 471
#10 indentations in python
python separates block of codes by indentation
if x==1:
print(2) ❌
if x==1:
print(2) ✔
you can use either tabs or space
if you decide 3 space characters, stick to it
if x==1:
print(2)
else:
print(3) ❌
if x==1:
print(2)
else:
print(3) ✔
🍂 editors nowadays if you press tab, they normally add 4 spaces for you, so, ease and convenience mixed !
1 471
#9 python: conditionals
🍏 example
x = 5
if x == 5:
print("x equals 5")
else:
print("x does not equal 5")
it will output
x equals 5
🍏 other operators
x = 6
if x > 5:
print("x greater than 5")
else:
print("x less than 5")
outputs
x greater than 5
🍏 other operators
< less than
!= not equal to
>= greater equal to
<= less equal to
🍏 smart python
if 3
1 471
How python can ease your daily life
https://avilpage.com/2014/08/amazing-things-to-do-with-python-in.html
1 471
#8 python: more operators
🔰 +=
x += 1 means
x = x + 1
x = 0; x += 1
now x is 1
🔰 -=
x = 5
x -= 1
x now 4
🔰 *=
x = 5
x *= 4
x now 20
🔰 /=
x = 10
x /= 5
x now 2.0
🔰 //=
x = 13
x //= 2
x now 6
https://code.dcoder.tech
1 471
#7 python: print
print is used to output to the screen
print(1)
>>> 1
print(1,2,3)
>>> 1 2 3
print(1, "a")
>>> 1 a
print(1,2)
print(3,4)
>>>
1 2
3 4
⛱ sep
print(1,2,3, sep="@")
>>> 1@2@3
⛱ end
end specifies which character to put at the end. default is newline
print(1,2,3, end="%")
print(5,6)
>>> 1 2 3%5 6
1 471
#6 python: comments
comments are used to provide information about the code and are ignored by the interpreter.
🎈 single line comments
single line comments start with #
# this is a comment
example
# apples in our basket
x = 5
🎈 multiline comments
multiline comments are enclosed in """ """ or ''' '''
x = 1
"""
this
is
a
comment
"""
y = 2
🎈 on efficiency
single line comments are ignored by the interpreter whereas multiline comments are put in memory. large chuncks of the latter affect efficiency
1 471
#5 python: more on strings
strings can be like
x = "i am here"
or
x = 'i am here'
or multiline
x = '''
i
am
here
'''
or
x = """
i
am
here"""
⭐️ use of mixing " and '
if you have like *i didn't* you cannot wrap it with ' like
x = 'i didn't'
as the interpreter will be confused
you do it like
x = "i didn't "
same to store "
x = 'a " a'
⭐️ string multiplication
"a" * 4
gives
aaaa
⭐️ string addition (concatenation)
"ab" + "c"
gives
"abc"
