From 613785f8f8ffbfe8dbbfa2a4aa7ad35053f2d017 Mon Sep 17 00:00:00 2001 From: asddataking Date: Mon, 21 Mar 2022 10:17:16 -0400 Subject: [PATCH 1/6] still working lab04 --- code/dan/lab04.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 code/dan/lab04.py diff --git a/code/dan/lab04.py b/code/dan/lab04.py new file mode 100644 index 00000000..e965c61b --- /dev/null +++ b/code/dan/lab04.py @@ -0,0 +1,35 @@ + +answer = input ("Please choose a number: ") # Requestes user input a number + + +# basic dictionary +numdict = { + 1 : "one", + 2 : "two", + 3 : "three", + 4 : "four", + 5 : "five", + 6 : "six", + 7 : "seven" , + 8 : "eight", + 9 : "nine", + 10 : "ten", + 20 : "twenty", + 30 : "thirty", + 40 : "fourty" , + 50 : "fifty", + 60 : "sixty", + 70 : "seventy", + 80 : "eighty", + 90 : "ninety", + 100: "one hundred", + +} +answer = input ("Please choose a number: ") # Requestes user input a number +new_answer = int(answer) + +# if key == user input then print value of that key. +if new_answer in numdict: + print(numdict[new_answer]) +else: + print ("Out of dictionary bounds") \ No newline at end of file From 1ed1c631dd52128325778f217b709941e3ce455d Mon Sep 17 00:00:00 2001 From: asddataking Date: Mon, 21 Mar 2022 18:03:33 -0400 Subject: [PATCH 2/6] Lab04 updates still working --- code/dan/lab04.py | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/code/dan/lab04.py b/code/dan/lab04.py index e965c61b..a88a051d 100644 --- a/code/dan/lab04.py +++ b/code/dan/lab04.py @@ -1,5 +1,13 @@ answer = input ("Please choose a number: ") # Requestes user input a number +new_answer = int(answer) + + +value = int(answer) +ones = value % 10 +tens = (value % 100) // 10 +hundreds = value // 100 +print (f"{hundreds} hundreds {tens} tens {ones} ones") # basic dictionary @@ -14,6 +22,15 @@ 8 : "eight", 9 : "nine", 10 : "ten", + 11 : "eleven", + 12 : "twelve", + 13 : "thirteen", + 14 : "fourteen", + 15 : "fifteen", + 16 : "sixteen", + 17 : "seventeen", + 18 : "eighteen", + 19 : "nineteen", 20 : "twenty", 30 : "thirty", 40 : "fourty" , @@ -25,11 +42,35 @@ 100: "one hundred", } -answer = input ("Please choose a number: ") # Requestes user input a number -new_answer = int(answer) + +x = numdict[hundreds] +y = numdict[tens] +z = numdict[ones] +print (x,y,z) + # if key == user input then print value of that key. if new_answer in numdict: print(numdict[new_answer]) else: - print ("Out of dictionary bounds") \ No newline at end of file + print ("Out of dictionary bounds") + + + + #number text list +a_list = ['zero', 'one', 'two','three', 'four', "five",'six','seven','eight','nine',] + +answer = input ("Please choose a number: ") # Requestes user input a number + +value = int(answer) + +for char in answer: + char = int(char) + print(a_list[char]) + +value = int(answer) +ones = value % 10 +tens = (value % 100) // 10 #not right +hundreds = value // 100 +print (f"{hundreds} hundreds {tens} tens {ones} ones") + \ No newline at end of file From c2869d0f8e8889202b91af1cad8eaa920e07f275 Mon Sep 17 00:00:00 2001 From: asddataking Date: Mon, 25 Apr 2022 20:38:58 -0400 Subject: [PATCH 3/6] Completed lab4 --- code/dan/lab4again.py | 60 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 code/dan/lab4again.py diff --git a/code/dan/lab4again.py b/code/dan/lab4again.py new file mode 100644 index 00000000..543ca99d --- /dev/null +++ b/code/dan/lab4again.py @@ -0,0 +1,60 @@ +answer = input ("Please choose a number: ") # Requestes user input a number +new_answer = int(answer) + +value = int(answer) +ones_place = value % 10 +print (ones_place) +tens_place = (value % 100) // 10 +print (tens_place) +hundreds_place = value // 100 +print (hundreds_place) + + + +ones = { + 0 : "zero", + 1 : "one", + 2 : "two", + 3 : "three", + 4 : "four", + 5 : "five", + 6 : "six", + 7 : "seven" , + 8 : "eight", + 9 : "nine", + +} +teens ={ + 0 : "ten", + 1 : "eleven", + 2 : "twelve", + 3 : "thirteen", + 4 : "fourteen", + 5 : "fifteen", + 6 : "sixteen", + 7 : "seventeen", + 8 : "eighteen", + 9 : "nineteen", +} +tens ={ + 2 : "twenty", + 3 : "thirty", + 4 : "fourty" , + 5 : "fifty", + 6 : "sixty", + 7 : "seventy", + 8: "eighty", + 9: "ninety", +} + + +if tens_place == 0: + print(f"Your total is {ones[ones_place]}") +elif tens_place == 1: + print(f"Your total is {teens[ones_place]}") +elif tens_place > 1 and ones_place == 0: + print(f"Your total is {tens[tens_place]}") +elif tens_place > 1 and ones_place >= 0: + print(f"Your total is {tens[tens_place]} {ones[ones_place]}") + + From 382947f03709b6e6a4d78a8043bc483644bb8602 Mon Sep 17 00:00:00 2001 From: asddataking Date: Mon, 25 Apr 2022 20:46:59 -0400 Subject: [PATCH 4/6] Adding all changes lab4 --- code/dan/lab04.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/code/dan/lab04.py b/code/dan/lab04.py index a88a051d..b3487661 100644 --- a/code/dan/lab04.py +++ b/code/dan/lab04.py @@ -55,7 +55,11 @@ else: print ("Out of dictionary bounds") - + + + + +# Version 2 #number text list a_list = ['zero', 'one', 'two','three', 'four', "five",'six','seven','eight','nine',] @@ -67,10 +71,12 @@ for char in answer: char = int(char) print(a_list[char]) - + + value = int(answer) ones = value % 10 tens = (value % 100) // 10 #not right hundreds = value // 100 print (f"{hundreds} hundreds {tens} tens {ones} ones") + \ No newline at end of file From b1f550c02276a9d18c603eef4b6a5848322358fd Mon Sep 17 00:00:00 2001 From: asddataking Date: Sun, 15 May 2022 14:45:00 -0400 Subject: [PATCH 5/6] Lab 4 completed --- code/dan/lab4again.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/code/dan/lab4again.py b/code/dan/lab4again.py index 543ca99d..761993bb 100644 --- a/code/dan/lab4again.py +++ b/code/dan/lab4again.py @@ -46,10 +46,23 @@ 8: "eighty", 9: "ninety", } +hundreds ={ + 1: "one hundred", + 2 : "two hundred", + 3 : "three hundred", + 4 : "four hundred" , + 5 : "five hundred", + 6 : "six hundred", + 7 : "seven hundred", + 8: "eight hundred", + 9: "nine hundred", +} if tens_place == 0: print(f"Your total is {ones[ones_place]}") +elif hundreds_place >= 1: + print(f"Your total is {hundreds[hundreds_place]} {tens[tens_place]} {ones[ones_place]}") elif tens_place == 1: print(f"Your total is {teens[ones_place]}") elif tens_place > 1 and ones_place == 0: @@ -58,3 +71,4 @@ print(f"Your total is {tens[tens_place]} {ones[ones_place]}") + From bae9b62bf538643a1bf53505015056a977d90b2c Mon Sep 17 00:00:00 2001 From: asddataking Date: Sun, 15 May 2022 14:49:23 -0400 Subject: [PATCH 6/6] Lab 4 is actually lab4again --- code/dan/lab04.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/dan/lab04.py b/code/dan/lab04.py index b3487661..873a8ae2 100644 --- a/code/dan/lab04.py +++ b/code/dan/lab04.py @@ -75,7 +75,7 @@ value = int(answer) ones = value % 10 -tens = (value % 100) // 10 #not right +tens = (value % 100) // 10 hundreds = value // 100 print (f"{hundreds} hundreds {tens} tens {ones} ones")