What's new

Closed [0] python basics

Status
Not open for further replies.

Vladimir420

Addict
Established
Joined
Dec 10, 2018
Posts
86
Reaction
33
Points
103
Mema share muna.
Python basics muna.
Why python? ito kasi main PL ko.
Data types: list, dictionary, string, integer, float, conclusion, boolean, math func

List = []
Dictionary = {}
String = 'string'
Integer = 12345
Float = 1.2
Conclusion = print()
Boolean = true/flase
Functions = +,-,*,/

Dun sa tayo sa pinaka basic. Number guessing game. Simple program..code below.
Code:
import random
#import natin yung module na random for access ng random functions

rand_this = [1, 2, 3, 4, 5, 6]
#integers in a list

guess = input('Guess a number from 1-6 \n')
#tatanungin kung anong hula mo.
#ang \n ay new line

result = random.choice(rand_this)
#pipili ang script ng choice dun sa list natin sa taas. RANDOMLY

if int(guess) == result:
    print('You win!', guess, 'is', result)
else:
    print('Sorry.', guess, 'is not', result)
#if and else statement. Yung nasa baba ay ang conclusions ang 'if' ay condition. Uri sya ng function.
#ang int() naman ay conversation from string. To integer.

Same lang kay word guessing game.
Ang pagkakaiba lang ay string ang nasa loob ng list at di na kelangan iconvert kasi string ang output ng input().

Next topic: 'while'
 
Thanks for sharing.

sana nilagyan mo nalang po ng loop para di mag end agad yung program. tipong

"Do you want to guess again"?
 
Use Pycharm for scripting instead of Using Python IDLE.


yes, the best daw ang Pycharm for windows IDE. it's a rich IDE with support for web frameworks like django, google app engine, etc. sobrang mahal ko lang kasi si C# at VB.Net kaya di ako gumagamit ng Python pero the best language to. highly ρáíd at very easy to learn. In fact, di mo na kaylangan ng intensive lessons para matuto, di gaya ng C-Like language na mejo mahirap pag aralan.
 
yes, the best daw ang Pycharm for windows IDE. it's a rich IDE with support for web frameworks like django, google app engine, etc. sobrang mahal ko lang kasi si C# at VB.Net kaya di ako gumagamit ng Python pero the best language to. highly ρáíd at very easy to learn. In fact, di mo na kaylangan ng intensive lessons para matuto, di gaya ng C-Like language na mejo mahirap pag aralan.
Javascript "Hello World" .
<script>
alert( 'Hello, world!' );
</script>

Pag sa Python.

print("Hello World!") That's alot more easier XD
 
Gamit ko Atom for pc/laptop. Sa cp naman termux or pydroid3. Mas ok sa akin ang termux in my opinion. hehehe
 
Last edited:
Status
Not open for further replies.

Similar threads

Back
Top