# Richard Czarapata
# CS1411
# Lab Section 502
# Slope of a line
#
# A simple program which prompts the user for the amount of Hydrogen(h),
Carbon(ca),
# and Oxygen(o) atoms, and then computes and prints the molecular weight of each
element.
#
# Atoms_to_
# Richard Czarapata
# CS1411
# Lab Section 502
# Slope of a line
#
# A program which promts the user for two point coordinated on a plane and then
# computes and prints the corresponding slope of the line from one point
# to the other.
#
# If x1, y1, x2,a
#
# Gomoku.py
#
# February 2013
# Dr. J. Nelson Rushton, Texas Tech University
#
# This program, when run, allows the player to play a single game of
# gomoku, or "five in a row". The blue and green players take turns
# moving at the intersections on the
# Richard Czarapata
# CS1411-502
# Lab 6
from tpge import *
import random
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
initial_state: S
initial_state() returns the initial state of the game
images: S -> L
images(S) is the list of images needed to be draw
#
#
#
#
#
#
#
Richard Czarapata
CS1411
Lab Section 502
Disance Conversion
A program which prompts the user for a distance in Kilometers and then
computes and prints the corresponding amount in Miles.
# Kilometers_to_Miles : R -> R
# If K is a real number
def print_date_time(date_time):
"Take input in the form "MM/DD/YYYY HR:MIN:SEC", and print it."
date = date_time.split()[0]
time = date_time.split()[1]
month = int(date.split("/")[0])
day = int(date.split("/")[1])
year = int(date.split("/")[2])
month_year
#Name: paresh parihar
#Course: 1411
#Date: 2/6/2017
#
#
#Problem:Write a program that will prompt the user for an integer number that
indicates the number of days after 9/25/09. You will calculate the distance of
Voyager from the sun using numbers from 9/
#Name: Paresh Parihar
#Course: CS1411
#
#Analysis:
#
#Input: string value
#
#Output: characters of string decrypted as per transposition cipher
#
#Test Cases:
#
#Input: og flv el igt heSnso oew'lsn ote,
#Output: Songs of love we'll sing to thee
#
#Input:
#Name: Paresh Parihar
#Course: CS1411
#
#Analysis
#
#Input: string value
#
#Output: characters of string encrypted as per transposition cipher
#
#Test Cases:
#Input: Fight, Matadors, For Tech!
#Output: ih,Mtdr,FrTc!Fgt aaos o eh
#Input: Stand on heights o
#Name: Paresh Parihar
#Course: CS1411
#
#Analysis:Allow user to give options to choose
#
#Input: Select the option to select from a list
#
#Output: A list of options open from sub-folder
#
#Test Cases:
#
#Input: 2
#Output:Photos
#
List of Photos
#
#Progra
#Name: Paresh Parihar
#Course: CS1411
#
#Analysis:Program to find if payment is succesfull or not
#
#Input: Enter amount to be paid
#
#Output: Show if the payment was succesfull or not
#
#Test Cases:
#
#Input: 43
#Output:Amount to be paid: 43
#
Payment su
#Name: Paresh Parihar
#Course: CS1411
#
#Analysis:decrypting an encrpted file
#
#Input: Encrypted.TXT
#
EncryptionKey.txt
#Output: a file with the decrypted message
#
#Test Cases:
#
#Input: nec xuj wel ?
#Output:how are you ?
#
#Input: P xt qprj
#Output:
#Name: Paresh Parihar
#Course: CS1411
#
#Analysis:Predict the amount to be paid
#
#Input: Amount of purchase
#
#Output: Shows the amout yet to be paid after discount
#
#Test Cases:
#
#Input: 65
#Output:Enter the cost of purchase: 65
#Are you a member of t
# Richard Czarapata
# CS1411
# Lab Section 502
# Volume of a Sphere
#
# A program which promts the user for the radius of a sphere and then
# computes and prints the corresponding amount for the total volume
# of the sphere.
#
# If r is a real number corr
# Richard Czarapata
# CS1411
# Lab Section 502
# Gregorian epact
#
# A program which promts the user for a year and then prints and computes the
Gregorian epact.
#
# If (year) is a four digit integer, then the Gregorian epact = (8+
(year/100)/4)-(year/100
# Richard Czarapata
# CS1411
# Lab Section 502
# Slope of a line
#
# A program which promts the user for two point coordinated on a plane and then
# computes and prints the corresponding distance between each pair of real
numbers
#
# If x1, y1, x2,and y2
# Richard Czarapata
# CS 1411 502
# Final Project
from math import *
#
#
#
#
Problem 1
If we list all the natural numbers below 10 that are multiples of 3 or 5, we
get 3, 5, 6, and 9. The sum of these multiples is 23. Find the sum of all the
multiples of
#
#
#
#
Alexis Miller
R11150988
Lab Section 2
Final Project
from math import *
# Problem 4
# is_palindrome: Z -> B
# is_palindrome(I) returns True if I is a palindrome
def is_palindrome(I):
S = str(I)
return True if len(S)=0 or len(S)=1\
else S[0]=S[-1] a
Discussion
a. Richard - 1, 2, 3, 6, 10
b. Alexis - 4, 5, 7, 8, 9
c. - Problem 1; The program starts at number 3, because anything less isn't
divisible by 3 or 5, and increases by 1 up until 1000. It checks to see
if the number is divisible by 3 or 5 and
# Richard Czarapata
# CS1411-502
# Lab 6
from tpge import *
import random
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
initial_state: S
initial_state() returns the initial state of the game
images: S -> L
images(S) is the list of images needed to be draw
"
Tiny Python Game Engine
This module provides a very simple Python game engine for writing elementary
turn based games with primitive 2D graphics in a 640x480 window.
LICENSE: This is open-source software released under the terms of the
BSD 2-Clause Lice
# Richard Czarapata
# CS1411
# Lab Section 502
#
# Exercise 1
#
# Product: Z * Z -> Z
# If m and n are integers, product(m,n) is the product of all of the integers in
the interval [m,n).
def product(m,n):
return 1 if m>=n else m * product(m+1,n)
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
Richard Czarapata
CS1411
Lab Section 502
Volume of a cube
A program which allows the user to calculate Volume of a cube, given
one side length of the cube.
sL_to_Volume : R -> R
If S is a real number corresponding to the volume of a
#
#
#
#
#
#
#
#
#
#
#
#
#
#
Richard Czarapata
CS1411
Lab Section 502
The Konditorei coffee shop
A program which permits the user to calculate the cost of his/her order of
coffee, given the amount of pounds the user intends to purchase given an
amount of p
# Richard Czarapata
# CS1411
# Lab Section 502
# Distance from Lightning strike
#
# A program to calculate the distance of a lightning strike from the users
position
# and then converts the answer calculated by distance from feet into miles.
#
# TimeElaps
numbers = []
while True:
try:
line = input("enter a number or Enter to finish: ")
if not line:
break
numbers.append(int(line)
except ValueError as err:
print(err)
count
sum
lowest
highest
mean
=
=
=
=
=
len(numbers)
sum(numbers)
min(numbers)
max(numbers)
numbers = []
while True:
line = input("enter a number or Enter to finish: ")
if not line:
break
numbers.append(int(line)
count
sum
lowest
highest
mean
=
=
=
=
=
len(numbers)
sum(numbers)
min(numbers)
max(numbers)
sum / count
calculate_med = int(len(number
Types, Functions
Introduce a language that introduces types.
A type is a sort of object.
From now on, be responsible for types discussed in class
Primitive types: those provided by the language.
In python 1) boolean (indicated by a |B) Values - True False
Language and Symbols
Natural Languages | Formal Language
More ambiguity
Both types have Syntax, Symmantex,
form words convey meaning correctly
Two main things.
string consists of 0 or more characters " or " asdflkadsfkl;adf"
symbols - special kinds of str
Tokenized strings
Strings evaluated for symbols
Look at "2+3-5" ['2', '+', '3', '-', '5']
These symbols represent values and operators.
Operator properties:
Look at 2+3
This is a plus expression.
(2+3)-5 this is a minus expression, the primary operator
ar
numbers = []
while True:
line = input("Please enter a number or Enter to finish: ")
if not line:
break
numbers.append(int(line)
count
sum
lowest
highest
mean
=
=
=
=
=
len(numbers)
sum(numbers)
min(numbers)
max(numbers)
sum / count
print('The numbers you
numbers = []
while True:
try:
line = input("enter a number or Enter to finish: ")
if not line:
break
numbers.append(int(line)
except ValueError as err:
print(err)
count
sum
lowest
highest
mean
=
=
=
=
=
len(numbers)
sum(numbers)
min(numbers)
max(numbers)
numbers = []
while True:
try:
line = input("enter a number or Enter to finish: ")
if not line:
break
numbers.append(int(line)
count
sum
lowest
highest
mean
median
=
=
=
=
=
=
len(numbers)
sum(numbers)
min(numbers)
max(numbers)
sum / count
'123'
sort(numbe
import time
def createDictionary ( file ) : #funtion to create movies dictionary with keys
as the Movie Names and the value as the set of actors
moviesDictionary = dict()
for line in file :
lineList = line.strip('\n').split(',')
for i in range(1,len(lineL