# # Author: Jessica Joyce Borlongan # Student ID: 998420844 # Date: 11/15/2013 # # Problem 1: Splicing Strings # Write a Python program that reads # from standard input a long string S # and outputs four new strings: # 1. String Manipulation # S = "Computers" print S S2 = S[7::1] S3 = S[0:2:1] S4 = S[1:7:2] S5 = S[0:3:1], S[6::1] print S2, S3, S4, S5 print "\n" # # Problem 2: Encryption # Write a Python program that reads in a string S # and an integer number N and encripts S based on N # # 1. Encrypting Process S = "Biotechnology" print S N = 4 S[1::-1] print S[1::-1] print "\n" # # Problem 3: Computing Change # Write a Python program that reads in a change # amount (assumed to be between 0 and 99 cents) and # computes the minimal number of coins needed # to tend this change. # # 1. Needed Arrays Tens = [" ", "10", "20", "30", "40", "50", "70", "80", "90"] Units = [" ", "1", "2", "3", "4", "5", "6", "7", "8", "9"] # # 2. Input: ask user for their change of coins. Change = int(raw_input("Enter your total change in cents:")) # # 3. Computing Change # Quarters = Change/25 Dimes = Change/10 Nickels = Change/5 Pennies = Change/100 #
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question