Quick and basic Python
These are Python exercises completed in class around July 2021 (except, admittedly, the Rock Paper and Scissors game and the temperature conversion program, which I updated more recently (September))
List of contents
-
BullsAndCows
- A traditional game where the computer selects a random 4 digit number (no repeats), and the player must try and guess this number. Guess a digit in the correct 'place' and that's a Bull. Guess a correct number, but in the wrong place, you've got yourself a cow. e.g. Com: 1234 | You: 1624 = 2 Bulls (1, 4), 1 Cow (2). Of course, in the real game, you're not told which numbers are cows and which are bulls ;)
-
CaseCount
- A program that counts the number of upper and lower case letters in a string the user has inputted
-
ConvertTemperatures
- Allows you to convert Celsius to Fahrenheit, and vice versa
-
EveryDigitEven
- Prints out every number within range 100-400 incl., where each digit of the number is even
-
FizzBuzz
- You know what FizzBuzz is
-
GuessTheNumber
- COM guesses a number between 1-9 randomly; player must guess the number within 5 tries
-
IsItPrime
- User inputs a number: computer tells user if it is in fact(!) a prime number. Writing this one kicked my ass hard at the time, I'm not sure why? Wild.
-
MaxofThree
- User inputs three separate numbers and Python picks out the biggest number!
-
MeatCooker
- User inputs the type of meat they wish to cook (from a choice of 4 meats), along with the meat's weight in kg. The program then tells you how long the meat should be cooked for!* (I just repeated the word "meat" so much, it doesn't mean anything anymore. Meat.)
-
PasswordGenerator
- Generate a random password as needed: set the number of letters, numbers and special characters you wish!
-
RangeExercises
- Exercises making use of Python's range() function; pretty basic!
-
ReverseUserString
- Takes a string from the user and reverses the word order of that string
-
RockPaperScissors
- You know what this is :-)
-
TipCalculator
- Calculate how much each person in your group should pay towards an evenly split bill; staff tip included.
--
*HMthyl cannot be held responsible for over or undercooked meats.