## Currency Converter

0 likes • Nov 19, 2022 • 0 views
Python

## More Python Posts

```# Prompt user for a decimal numberdecimal = int(input("Enter a decimal number: "))
# Convert decimal to binarybinary = bin(decimal)

#### check prop lambda

0 likes • Nov 19, 2022 • 0 views
Python
`def check_prop(fn, prop):  return lambda obj: fn(obj[prop])  check_age = check_prop(lambda x: x >= 18, 'age')user = {'name': 'Mark', 'age': 18}check_age(user) # True`

#### Calculate the Area of a Triangle

0 likes • May 31, 2023 • 0 views
Python
```# Prompt user for base and heightbase = float(input("Enter the base of the triangle: "))height = float(input("Enter the height of the triangle: "))
# Calculate the areaarea = (base * height) / 2
# Display the resultprint("The area of the triangle is:", area)```

0 likes • Nov 19, 2022 • 0 views
Python
`#Loop back to this point once code finishesloop = 1while (loop < 10):#All the questions that the program asks the user    noun = input("Choose a noun: ")    p_noun = input("Choose a plural noun: ")    noun2 = input("Choose a noun: ")    place = input("Name a place: ")    adjective = input("Choose an adjective (Describing word): ")    noun3 = input("Choose a noun: ")#Displays the story based on the users input    print ("------------------------------------------")    print ("Be kind to your",noun,"- footed", p_noun)    print ("For a duck may be somebody's", noun2,",")    print ("Be kind to your",p_noun,"in",place)    print ("Where the weather is always",adjective,".")    print ()    print ("You may think that is this the",noun3,",")    print ("Well it is.")    print ("------------------------------------------")#Loop back to "loop = 1"    loop = loop + 1`

#### Rock paper scissors

0 likes • Nov 19, 2022 • 0 views
Python
`""" Rock Paper Scissors----------------------------------------"""import randomimport osimport reos.system('cls' if os.name=='nt' else 'clear')while (1 < 2):    print "\n"    print "Rock, Paper, Scissors - Shoot!"    userChoice = raw_input("Choose your weapon [R]ock], [P]aper, or [S]cissors: ")    if not re.match("[SsRrPp]", userChoice):        print "Please choose a letter:"        print "[R]ock, [S]cissors or [P]aper."        continue    // Echo the user's choice    print "You chose: " + userChoice    choices = ['R', 'P', 'S']    opponenetChoice = random.choice(choices)    print "I chose: " + opponenetChoice    if opponenetChoice == str.upper(userChoice):        print "Tie! "    #if opponenetChoice == str("R") and str.upper(userChoice) == "P"    elif opponenetChoice == 'R' and userChoice.upper() == 'S':              print "Scissors beats rock, I win! "        continue    elif opponenetChoice == 'S' and userChoice.upper() == 'P':              print "Scissors beats paper! I win! "        continue    elif opponenetChoice == 'P' and userChoice.upper() == 'R':              print "Paper beat rock, I win! "        continue    else:               print "You win!"`

#### Copy file to destination

0 likes • Nov 18, 2022 • 1 view
Python
```# importing the modulesimport osimport shutil
# getting the current working directorysrc_dir = os.getcwd()
# printing current directoryprint(src_dir)
# copying the filesshutil.copyfile('test.txt', 'test.txt.copy2') #copy src to dst
# printing the list of new filesprint(os.listdir())```