Skip to content

Commit b708c88

Browse files
committed
Modified some files
1 parent 7ac7f8d commit b708c88

File tree

9 files changed

+50
-55
lines changed

9 files changed

+50
-55
lines changed

Basic Scripts/IPD.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,31 @@
66
from bs4 import BeautifulSoup
77
import datetime
88
def ShowHelp():
9-
print 'Insta Image Downloader'
10-
print ''
11-
print 'Usage:'
12-
print 'insta.py [OPTION] [URL]'
13-
print ''
14-
print 'Options:'
15-
print '-u [Instagram URL]\tDownload single photo from Instagram URL'
16-
print '-f [File path]\t\tDownload Instagram photo(s) using file list'
17-
print '-h, --help\t\tShow this help message'
18-
print ''
19-
print 'Example:'
20-
print 'python insta.py -u https://instagram.com/p/xxxxx'
21-
print 'python insta.py -f /home/username/filelist.txt'
22-
print ''
9+
print ('Insta Image Downloader')
10+
print ('')
11+
print ('Usage:')
12+
print ('insta.py [OPTION] [URL]')
13+
print ('')
14+
print ('Options:')
15+
print ('-u [Instagram URL]\tDownload single photo from Instagram URL')
16+
print ('-f [File path]\t\tDownload Instagram photo(s) using file list')
17+
print ('-h, --help\t\tShow this help message')
18+
print ('')
19+
print ('Example:')
20+
print ('python insta.py -u https://instagram.com/p/xxxxx')
21+
print ('python insta.py -f /home/username/filelist.txt')
22+
print ('')
2323
exit()
2424
def DownloadSingleFile(fileURL):
25-
print 'Downloading image...'
25+
print ('Downloading image...')
2626
f = urllib.urlopen(fileURL)
2727
htmlSource = f.read()
2828
soup = BeautifulSoup(htmlSource,'html.parser')
2929
metaTag = soup.find_all('meta', {'property':'og:image'})
3030
imgURL = metaTag[0]['content']
3131
fileName = datetime.datetime.now().strftime("%Y-%m-%d_%H:%M:%S") + '.jpg'
3232
urllib.urlretrieve(imgURL, fileName)
33-
print 'Done. Image saved to disk as ' + fileName
33+
print( 'Done. Image saved to disk as ' + fileName)
3434
if __name__ == '__main__':
3535
if len(argv) == 1:
3636
ShowHelp()

Basic Scripts/NUMBER_GUESS.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def start_game():
1313
print("Hello traveler! Welcome to the game of guesses!")
1414
player_name = input("What is your name? ")
1515
wanna_play = input("Hi, {}, would you like to play the guessing game? (Enter Yes/No) ".format(player_name))
16-
// Where the show_score function USED to be
16+
# Where the show_score function USED to be
1717
attempts = 0
1818
show_score()
1919
while wanna_play.lower() == "yes":

Basic Scripts/RockPaperScissor .py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,29 @@
66
import re
77
os.system('cls' if os.name=='nt' else 'clear')
88
while (1 < 2):
9-
print "\n"
10-
print "Rock, Paper, Scissors - Shoot!"
11-
userChoice = raw_input("Choose your weapon [R]ock], [P]aper, or [S]cissors: ")
9+
print("\n")
10+
print("Rock, Paper, Scissors - Shoot!")
11+
userChoice =input("Choose your weapon [R]ock], [P]aper, or [S]cissors: ")
1212
if not re.match("[SsRrPp]", userChoice):
13-
print "Please choose a letter:"
14-
print "[R]ock, [S]cissors or [P]aper."
13+
print("Please choose a letter:")
14+
print("[R]ock, [S]cissors or [P]aper.")
1515
continue
16-
// Echo the user's choice
17-
print "You chose: " + userChoice
16+
# Echo the user's choice
17+
print( "You chose: " + userChoice)
1818
choices = ['R', 'P', 'S']
1919
opponenetChoice = random.choice(choices)
20-
print "I chose: " + opponenetChoice
20+
print( "I chose: " + opponenetChoice)
2121
if opponenetChoice == str.upper(userChoice):
22-
print "Tie! "
22+
print( "Tie! ")
2323
#if opponenetChoice == str("R") and str.upper(userChoice) == "P"
2424
elif opponenetChoice == 'R' and userChoice.upper() == 'S':
25-
print "Scissors beats rock, I win! "
25+
print( "Scissors beats rock, I win! ")
2626
continue
2727
elif opponenetChoice == 'S' and userChoice.upper() == 'P':
28-
print "Scissors beats paper! I win! "
28+
print( "Scissors beats paper! I win! ")
2929
continue
3030
elif opponenetChoice == 'P' and userChoice.upper() == 'R':
31-
print "Paper beat rock, I win! "
31+
print( "Paper beat rock, I win! ")
3232
continue
3333
else:
34-
print "You win!"
34+
print("You win!")

Basic Scripts/jumping_number.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@
1212
if res == 1:
1313
print("JUMPING NUMBER")
1414
else:
15+
#error issue to be raised
16+

Basic Scripts/leapyear.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Python program to check if year is a leap year or not
22

3-
year = 2000
3+
# year = 2000
44

55
# To get year (integer input) from the user
6-
# year = int(input("Enter a year: "))
6+
year = int(input("Enter a year: "))
77

88
if (year % 4) == 0:
99
if (year % 100) == 0:

Basic Scripts/number_to_hex.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ def number_to_hex(number_to_convert: int):
99
print(hexadecimal)
1010

1111
if __name__ == "__main__":
12-
"""
13-
>>> number_to_hex(7562)
14-
1D8A
15-
"""
16-
number_to_hex(7562)
12+
num= int(input("Enter number in decimal:\n"))
13+
number_to_hex(num)
14+
#added user input

Basic Scripts/primeNo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Program to check if a number is prime or not
22

3-
num = 29
3+
# num = 29
44

55
# To take input from the user
6-
#num = int(input("Enter a number: "))
6+
num = int(input("Enter a number: "))
77

88
# define a flag variable
99
flag = False

Basic Scripts/roman_to_dec.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ def RomanNumeralToDecimal(romanNumeral):
2020
sum += tallies[left]
2121
sum += tallies[romanNumeral[-1]]
2222
return sum
23+
romnum=input("Enter the roman number:\n")
24+
sum=RomanNumeralToDecimal(romnum)
25+
print(sum)
26+
#coder has not added userinput and output

Basic Scripts/swap.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
1-
# Python program to swap two variables
2-
3-
x = 5
4-
y = 10
5-
6-
# To take inputs from the user
7-
#x = input('Enter value of x: ')
8-
#y = input('Enter value of y: ')
9-
10-
# create a temporary variable and swap the values
11-
temp = x
12-
x = y
13-
y = temp
14-
15-
print('The value of x after swapping: {}'.format(x))
16-
print('The value of y after swapping: {}'.format(y))
1+
x=int(input("Enter first number:\n"))
2+
y=int(input("Enter second number:\n"))
3+
print("Before swapping:\n",x,"\n",y,"\n")
4+
#Inputting two numbers from user
5+
x,y=y,x
6+
#Swapping two variables
7+
print("After swapping:\n",x,"\n",y,"\n")

0 commit comments

Comments
 (0)