🔒 Closed Some of my Program in Python Language (Dagdag kaalaman para sa mga Kapwa ko Programmer)

Status
Not open for further replies.

Kenji246

Eternal Poster
Eto na naman from another kaalaman, etong mga gawa ko na program is mostly may pagka advance o medyo mahirap yung pagkaka coding but essentially mas maganda at understanding ang output neto.

Isa sa mga usable na data types and kadalasan na ginagamit ay dictionary, random, while, if else, print,mathematical,scientific evaluation and programming sign.

Feel free to copy if you want to find out the output

React muna:

Rock, Paper, Scissors

[CODE lang="python" title="Rock, Paper, Scissors"]import random
rps = ["Rock","Paper","Scissors"]
computer = rps[random.randint(0,2)]
player = False
player_score = 0
computer_score = 0
number_of_rounds = 1
print("Welcome to a game of Rock, Paper, Scissors")
rounds = int(input("How many rounds would you like to play : "))
while number_of_rounds <= rounds:
print("\n")
print("Game : ", number_of_rounds)
player = input("Rock, Paper, Scissors : ")
if player == computer:
print("Tie")
elif player == "Rock":
if computer == "Paper":
computer_score = computer_score + 1
print("Computer : ",computer_score,"\t","Player : ",player_score)
print("Computer : " + str(computer))
print("Player : " + str(player))
print("Paper cover Rock\n")
print("You Lost in Round ", number_of_rounds)
else:
player_score = player_score + 1
print("Computer : ",computer_score,"\t","Player : ",player_score)
print("Computer : " + str(computer))
print("Player : " + str(player))
print("You Win in Round ", number_of_rounds)
elif player == "Paper":
if computer == "Scissors":
computer_score = computer_score + 1
print("Computer : ",computer_score,"\t","Player : ",player_score)
print("Computer : " + str(computer))
print("Player : " + str(player))
print("Scissors Cut Paper")
print("You Lost in Round ", number_of_rounds)
else:
player_score = player_score + 1
print("Computer : ",computer_score,"\t","Player : ",player_score)
print("Computer : " + str(computer))
print("Player : " + str(player))
print("You win in Round ", number_of_rounds)
elif player == "Scissors":
if computer == "Rock":
computer_score = computer_score + 1
print("Computer : ",computer_score,"\t","Player : ",player_score)
print("Computer : " + str(computer))
print("Player : " + str(player))
print("Scissors Cut Rock\n")
print("You Lost in Round ", number_of_rounds)
else:
player_score = player_score + 1
print("Computer : ",computer_score,"\t","Player : ",player_score)
print("Computer : " + str(computer))
print("Player : " + str(player))
print("You win in Round ", number_of_rounds)
else:
print("That's not a Valid Point! Check your Spelling")

number_of_rounds = number_of_rounds + 1

print("\n")
print("Final Game Result")
print("Rounds Played : ",rounds)
print("Computer Score : ",computer_score)
print("Player Score : ",player_score)
if computer_score > player_score:
print("Winner : Computer ")
elif computer_score == player_score:
print("No one is Winner\nDraw")
else:
print("Winner : Player ")[/CODE]

Guess a Number

[CODE lang="python" title="Guess a Number"]import random
number = random.randint(1, 25)
number_of_guesses = 0;
while number_of_guesses < 5:

guess = int(input("Guess a number between 1 to 20 : "))

number_of_guesses = number_of_guesses + 1

if guess < number:
print("The Guess is to Low")
if guess > number:
print("The Guess is to High")
if guess == number:
break
if guess == number:
print("You Guessed the number in " + str(number_of_guesses) + "tries!")
else:
print("You Did not guess the Number")[/CODE]

Coin Toss App

[CODE lang="python" title="Coin Toss App"]import random
print("Welcome to the Coin Toss App")
print("\nI will flip a coin a set number of times.")
flip_number = int(input ("How many times would you like me to flip the coin: "))
choices = input ("Would you like to see the result of each flip (Yes/No) : ").lower()
print("\nFlipping!!!\n")
heads=0
tails=0
for flips in range(flip_number):
coin = random.randint(0,1)
if coin == 1:
heads += 1
if choices.startswith('Yes'):
print("Heads")
else:
tails += 1
if choices.startswith('No'):
print("Tails")
if heads == tails:
print("At " + str(flips + 1) + " flips, the number of heads and tails were equal at " + str(heads) + " each.")
Heads_Percentage = round(100*heads/flip_number, 2)
Tails_Percentage = round(100*heads/flip_number, 2)
print("\nResults of Flipping a Coin " + str(flip_number) + " Times: ")
print("\nSide\t\tCount\t\tPercentage")
print("Heads\t\t" + str(heads) + "/" + str(flip_number) + "\t\t" + str(Heads_Percentage) + "%")
print("Tails\t\t" + str(tails) + "/" + str(flip_number) + "\t\t" + str(Tails_Percentage) + "%")[/CODE]

Database Admin Program using Dictionary

[CODE lang="python" title="Database Admin Program using Dictionary"]print("Welcome to the Database Admin Program")
userInfo1 =
{
"Username" : "",
"Password" : "",
}
userInfo2 =
{
"Username" : "Kenji246",
"Password" : "Delacruz",
}
userInfo3 =
{
"Username" : "MrFadeAway",
"Password" : "petot",
}
allUserInfo = [userInfo1,userInfo2,userInfo3]
userInfo1['Username'] = input("Enter your username : ")
userInfo1['Password'] = input("Enter your password : ")
print("\n")
print("Hello!",userInfo1['Username']," You are logged in!\n")
print("Here is the current user Database : ")
print("\n")
for user in allUserInfo:
for key,value in user.items():
print(key.title()," : ",str(value))
print("\n")[/CODE]

Username is in the Database using Dictionary

[CODE lang="python" title="Username is in the Database using Dictionary"]print("Welcome to the Database Admin Program")
userinfo = {'Kuroko':'Delacruz','Ron':'Delacruz'}
username = input("Enter your Username : ")
password = input("Enter your Password : ")
if username and password in userinfo:
print("Your Name is in the Database")
else:
print("Sorry! Your name is not in database")[/CODE]


Dito muna ulit hehe dadagdagan ko pa yan mamaya sa mga gumagamit ng python try to copy this and see what is the output of this to be curious what function will be use to run the program.

Sa mga may assignment dyan click nyo to: https://phcorner.org/threads/kahit-load-lang-po-50-or-100.1024061/

Feedback mga lodi :)
 
Lods lahat ba ng programming alam mo? Napansin ko lang po halos lahat ng thread mo about programming.
Curious lang po😅😂
 
HAHAHAHA di po nagseself-study po kase ako sa mga programming language tyaka halos nung nagaaral ako hanggang sa ngayon na explore ko na yung ibat ibang programming language.
Mas gusto ko pa pong matutunan yung mga coding na pangmalakasan o mala formula ni einstein:ROFLMAO::ROFLMAO::ROFLMAO:
 
Status
Not open for further replies.

About this Thread

  • 10
    Replies
  • 768
    Views
  • 7
    Participants
Last reply from:
Mina Minari

Trending Topics

Online now

Members online
440
Guests online
2,503
Total visitors
2,943

Forum statistics

Threads
2,317,797
Posts
29,192,889
Members
1,181,645
Latest member
Rjcasem
Back
Top