diff --git a/week-2/assignment-2/mini_project.py b/week-2/assignment-2/mini_project.py new file mode 100644 index 0000000..87dd084 --- /dev/null +++ b/week-2/assignment-2/mini_project.py @@ -0,0 +1,8 @@ +fahrenheit = float(input("Enter a temperature in Fahrenheit:")) + +celcius = (fahrenheit - 32) * 5 / 9 + +print(f'{fahrenheit:.1f}°F is {celcius:.1f}°C.') + + + \ No newline at end of file diff --git a/week-2/assignment-2/warmup1.py b/week-2/assignment-2/warmup1.py new file mode 100644 index 0000000..f7ae2bf --- /dev/null +++ b/week-2/assignment-2/warmup1.py @@ -0,0 +1,3 @@ +print ('Python is working!') + + diff --git a/week-2/assignment-2/warmup2.py b/week-2/assignment-2/warmup2.py new file mode 100644 index 0000000..cd5eef7 --- /dev/null +++ b/week-2/assignment-2/warmup2.py @@ -0,0 +1,10 @@ +#navigations commands I used: +# cd python-intro-homework +#ls +#cd week-2 +#cd assignment-2 +#pwd + + +date = input("What is today's date? ") +print(f'You said today is {date}.') diff --git a/week-2/assignment-2/warmup3.py b/week-2/assignment-2/warmup3.py new file mode 100644 index 0000000..7654760 --- /dev/null +++ b/week-2/assignment-2/warmup3.py @@ -0,0 +1,7 @@ +# git log --oneline output: +# 194c8fa add warmup2.py +# 294742d add week 2 folder +# 58d836d Add files via upload +# d8c0c05 Update README.md + +print("This week I learned how to use Python input, work with strings, and run Git commands in the terminal!") diff --git a/week-2/assignment-2/warmup4.py b/week-2/assignment-2/warmup4.py new file mode 100644 index 0000000..44072ed --- /dev/null +++ b/week-2/assignment-2/warmup4.py @@ -0,0 +1,16 @@ + +# 1. What the error message said: + # NameError: name 'naame' is not defined. Did you mean: 'name'? + +#2. What caused it: + # I misspelled the variable name as 'naame' inside the print statement + # and forgot to include input() on line 1, so Python didn't know what 'naame' was. + +#3. How I fixed it: + # I added input() to line 1 to capture the user's input and corrected + # the spelling of the variable to 'name' in the print statement.''' + +# Fixed, working code: + +name = input("What is your name? ") +print(f"Your name is {name}.") diff --git a/week-3/assignment-3/mini_project.py b/week-3/assignment-3/mini_project.py new file mode 100644 index 0000000..db455c5 --- /dev/null +++ b/week-3/assignment-3/mini_project.py @@ -0,0 +1,33 @@ +day = input('Please enter a day of the week: ').strip().lower() +time_of_day = input("Please enter a time of day (morning, afternoon, or evening): ").strip().lower() + +if day == "monday": + if time_of_day == "morning": + print("Activity: Go for an early morning walk!! ") + elif time_of_day == "afternoon": + print('Activity: Make yourself a yummy snack!! ') + elif time_of_day == "evening": + print('Activity: Make yourself a yummy and healthy dinner') + else: + print('Invalid time of day') +elif day == "saturday": + if time_of_day == "morning": + print('Activity: Make yourself a nice cup of coffee to start your day!!') + elif time_of_day == "afternoon": + print('Activity: Spend your afternoon in a park or somewhere outdoors') + elif time_of_day == "evening": + print('Activity: Go and have nice dinner with a special someone') + else: + print('Invalid time of day') +elif day == "sunday": + if time_of_day == "morning": + print('Activity: Visit a local farmers market!!') + elif time_of_day == "afternoon": + print('Activity: Visit family or friends') + elif time_of_day == "evening": + print('Activity: Movie night!!') + else: + print('Invalid time of day') +else: + print('Invalid day of the week. Please choose Monday, Saturday, or Sunday!') + diff --git a/week-3/assignment-3/warmup1.py b/week-3/assignment-3/warmup1.py new file mode 100644 index 0000000..df9a800 --- /dev/null +++ b/week-3/assignment-3/warmup1.py @@ -0,0 +1,20 @@ +score = 100 +if score >= 90: + grade = 'A' +elif score >= 80: + grade = 'B' +elif score >= 70: + grade = 'C' +elif score >= 60: + grade = 'D' +else: + grade = 'F' + +print(f'Score: {score}') +print(f'Grade: {grade}') + + + + + + diff --git a/week-3/assignment-3/warmup2.py b/week-3/assignment-3/warmup2.py new file mode 100644 index 0000000..8e85828 --- /dev/null +++ b/week-3/assignment-3/warmup2.py @@ -0,0 +1,13 @@ +age = int(input('What is your age ')) + +if age >=0 and age <= 12: + print('You are a Child. ') +elif age >= 13 and age <= 17: + print(' You are a Teen. ') +elif age >= 18 and age <= 64: + print(' You are an Adult. ') +elif age >= 65: + print('You are a Senior') +else: + print('Invalid Age') + diff --git a/week-3/assignment-3/warmup3.py b/week-3/assignment-3/warmup3.py new file mode 100644 index 0000000..bef1175 --- /dev/null +++ b/week-3/assignment-3/warmup3.py @@ -0,0 +1,14 @@ +# 'not True' is False and since one side is False False and False gives False +print(not True and False) + +# 'True or False' only needs one to ne True so it gives True +print(True or False and False) + +# 5 is greater than 3 so thats True and adding not flips True to False so its False. +print(not (5 > 3)) + +# 10 equals 10 is true, but 4 not equal to 4 is False. Both arent True 'and' gives False +print(10 == 10 and 4 != 4) + +# 'not False' is True, and 'not True' is False. It gives True +print(not False or not True) \ No newline at end of file diff --git a/week-3/assignment-3/warmup4.py b/week-3/assignment-3/warmup4.py new file mode 100644 index 0000000..84f6b5b --- /dev/null +++ b/week-3/assignment-3/warmup4.py @@ -0,0 +1,16 @@ +number = int(input('Enter a number: ')) + +if number > 0: + print(f'{number} is positive.') +elif number < 0: + print(f'{number} is negative.') +else: + print(f'{number} is zero. ') + + + +if number % 2 == 0: + print(f'{number} is even. ') + +else: + print(f'{number} is odd.')