Administrator

[email protected]

Total likes received: 115 | Pubby Cash: 377


Andy Tang is the creator of Gopubby.com who has a passion for programming and everything related to technology and is skilled in many areas of coding including Python, HTML/CSS, Bootstrap, and SQL. He is experienced with many Python modules including Pygame, Flask, BeautifulSoup, and Kivy. He also has a solid knowledge of Windows, Mac, and Linux/Unix operating systems.

Articles Liked by Me: 82

An Online PDF Filling and Signing Tool - Smallpdf

Categories: Tech | Pubby Cash Received:  0

If you would like to edit a PDF file locally by a software installed on your machine, Acrobat is the common software to go. You can also use Photoshop to do advanced editing on PDF. Acrobat reader is free, but Acrobat and Photoshop are not and they are not cheap. If you don't care about your privacy regarding the PDF files you are trying to edit, you could use online PDF editing tools that are available almost everywhere. You need to upload the PDF file to the server and you interact with the server via the web GUI by filling blanks, drawing shapes, and signing names. The server will do the processing and provide you an edited version to download. This process does not rely on any client-end software and is easy to use. The only downside as I can see is the privacy. I cannot name one website that absolutely has no privacy issue, but Smallpdf is the online tool that I use occasionally for online PDF filling and signing. You could try them out on your non-sensitive PDF documents. ...  Read more

How to Use an If, Elif, and Else Statement in Python

Categories: Tech | Pubby Cash Received:  0

Do you know how to use an if statement in Python? If you do not know how you should read this article because it will teach you how. First of all, the if statement is written using the if keyword in Python. Python also supports the logical conditions of mathematics. Here is what an if statement can look like. a = 1 b = 2 if a < b:     print("a is less than b.") The code above basically means that a is equal to 1 and b is equal to 2. The if statement is saying that a is less than b. Since 1 is less than 2, this would print a is less than b.. You must also make sure that the print statement is indented after the if statement because Python relies on indentation. If you do not indent, an error will appear. There is also an elif statement. This statement means that if the previous conditions were not true, then try this condition. Here is what an elif statement could look like. a = 3 b = 3 if b > a:     print("b is greater than a") elif a == b:     print("a and b are equal") The code above means that if b is greater than a, print b is greater than a. However, b is not greater than a. Since it is not, it moves on to the elif statement. The elif is saying that if a and be are equal, print a and b are equal. Since a and b are equal, this would print a and b are equal. Finally, there is the else statement. The else statement means that it catches anything which isn't caught by the preceding conditions. Here is what an else statement could look like a = 2 b = 1 if b > a:     print("b is greater than a") elif a == b:     print("a and b are equal") else:     print("a is greater than b" The code above means that if b is greater than a, print b is greater than a. However, it is not, so it then sees if a and b are equal. Since a and b are not equal, the else statement sees if a is greater than b. Since 2 is greater than 1, this would print a is greater than b. Hopefully, after reading this article, you have a good idea of how the if, elif, and the else statement work....  Read more

How to Turn Some Data in a Dictionary Into a CSV File Using Python

Categories: Tech | Pubby Cash Received:  0

Do you know how to turn some data in a dictionary into a CSV File Using Python? If you do not know how here is a way to do it. You first need to import CSV. If you don't know what CSV stands for, it stands for a comma-separated values file. After importing CSV, you need to import datetime from datetime. The datetime means what the time and the date are. Here is an example. import csv from datetime import datetime After you do that, you have to open your data. You can do this using the with open method. After opening it, you have to use the read method and the eval method. Here is an example. f_path = 'stocks.txt' with open(f_path, 'r') as f:     content = f.read()     stocks = eval(content) Then, you can make an empty dictionary using curly brackets. After making a dictionary, use a for loop. Make sure you use k because k stands for key and you want to use the key. Here is an example. stocks_price = {} for k in stocks:     stocks_price[k]=stocks[k][1] stocks_price['Time'] = datetime.now() After doing that, you can use another for loop to append it to your key. The append method is used to add things. fnames = ['Time'] for k in stocks:     fnames.append(k) Next, you need to open a CSV file as a CSV file and use set the mode equal to w. The w stands for write. Then use the DictWriter method. This method can map Python dictionaries into CSV rows. Use the writeheader method after that. This method writes the headers to the CSV file. Here is an example. with open('stocks_history.csv', mode='w') as csv_file:     writer = csv.DictWriter(csv_file, fieldnames=fnames)     writer.writeheader() After that, use the now method. This method returns the current local date and time. The open your CSV file and make sure you set the mode to a+. The a+ means that you can open for reading and appending (writing at end of file). Finally, use the DictWriter and the writerow method. The writerow method writes a row of data into the specified file. Here is an example. stocks_price['Time'] = datetime.now() with open('stocks_history.csv', mode='a+') as f:     csv_writer = csv.DictWriter(f, fieldnames=fnames)     csv_writer.writerow(stocks_price) If you did all of the above correctly, you should have turned some data in a dictionary into a CSV file....  Read more

How to Play the Lottery Game on Gopubby.com

Categories: Tech | Pubby Cash Received:  0

If you are reading this article, you probably do not know how to play the lottery game on gopubby.com. If you do not know how, you should read this article because it will answer most of your questions. To play lottery at Gopubby.com, you just need to buy a lottery ticket for 10 Pubby Cash. The ticket includes three nonrepetitive numbers of your choice between 0 to 9. Everyday between 12:00 and 12:30pm, the winning numbers will be announced. If your ticket of the three numbers match the winning numbers, you will win the grand prize. If two of the three numbers match the two of the winning numbers, you will win a small price. If you are wondering the possibility you can make to win the grand prize, the correct answer is one out of one hundred twenty. To win the small prize, the chance of one out of fifteen. But why is this important for the lottery? Well, the number of combinations you can make shows the chance that you could win the grand or small prize. Now, I will explain how to calculate the possibility of combinations. The formula to calculate it is This may look confusing if you have never heard of this formula, but I will try my best to explain it. n is the number of different items that you can choose. r is the number of items that you are allowed to choose. ! just means you are multiplying it by the same value each time but subtracting one each time it is multiplied. You do this until it gets to one. For example, 3! is equal to 3*(3-1)*(3-2) or 3*2*1. This would be equal to 6. Let's try out this formula with the real Powerball numbers. This formula would be There are 31 numbers to choose from and you can only choose 5 of those 31 numbers. After calculating this, our final answer was 169,911 or about 170,000. That means out of about 170,000 people, only one person would win the grand prize. You can also write this as a decimal, by dividing 1 by 170,000. That means that there is a 0.00058824% chance of winning if you are playing real Powerball. However, when playing on Gopubby.com, out of ten numbers you pick three. The formula for this situation would be After calculating this there is a one out of 120 chance of winning the grand prize or a 0.833% chance of winning. Gopubby.com also offers a small prize winner, which means guessing 2 of the 3 numbers correctly. The formula for this situation is Considering the winning numbers are a set of three numbers, which offers three possible combinations of two numbers, so, 45/3 = 15. There would be a one out of 15 or 6.67% chance to win the small prize. As you can see, winning a lottery on Gopubby.com is a lot easier than winning one on Powerball. Now, I...  Read more

How to Create a Lottery System Using Python

Categories: Tech | Pubby Cash Received:  0

Do you know what Powerball is? If you do not know what it is, it is a lottery game. The computer randomly generates a set of 5 numbers between 1 through 31, and you have to try to guess it. If you guess all the numbers right, you get a lot of money. But if you guess some of the numbers correctly, you get a fraction of the money. In this article, I will explain how to create a lottery system using python. First of all, we will make the guessing numbers 0 to 9. We will also make a set of 3 numbers. This will make it easier to guess the number. The first thing you want to do is to make a winning set of numbers. We also need to make a few guesses using a dictionary. Here is an example. pool = {'andy':[(1,2,3),(2,3,4),(3,4,5)],'evan':[(1,7,3),(5,9,8),(4,3,7)] win = [7,4,3] After that, you need to make a few variables. Here is an example. big_tickets_numb = 0 #how many grand prize tickets big_winners = {} #who was the big winner or winners small_tickets_numb = 0 #how many small prize tickets small_winners = {} #who was the small winner or winners big_pcts = {} #percentage of money the big winner gets small_pcts = {} #percentage of money the small winner gets After making a few variables, you need to start looping them, because you want it to check your guesses multiple times. To do this, use the a for loop. You can also make a match_count variable to see how many times your guesses matched the real answer. Here is an example. for k in pool:     for j in range(len(pool[k])):         match_count = 0         for i in range(len(pool[k][j])):             if pool[k][j][i] in win:                 match_count += 1         if match_count == 2:             small_winners[k] = small_winners.get(k,0) + 1             small_tickets_numb += 1         if match_count == 3:             big_winners[k] = big_winners.get(k,0) + 1             big_tickets_numb += 1 Then, you need to figure out how much percent each person gets if multiple people get the same winning value. To do this use an if statement followed by a for loop and then return those values. The big winner gets 80 percent of the money and the small winner get 20 percent of the money. But if two people both get the big money or the small money, then we must divide them equally. Here is an example. if small_winners:     for k in small_winners:         small_pcts[k] = small_winners[k]*0.2/small_tickets_numb if big_winners:     for k in big_winners:         big_pcts[k] = big_winners[k]*0.8/big_tickets_numb return small_winners,small_pcts,big_winners,big_pcts Finally, put all of what you just did into a function and then print it. Here is an example. def lottery_winner(pool, win): #Put everything you just did right here small_winners,small_pcts,big_winners,big_pcts = lottery_winner({'Evan':[(1,2,3)]},[1,2,3]) print(small_winners,big_winners) print(small_pcts,big_pcts) If you did all of that, you should have a working lottery system....  Read more

1 ... 7 8 9 ... 17

Daily Deals


MECHANICSBURG WEATHER