Challenges 2
Challenges 2
2a). Get someone the enter their name and then:
Low: Print it out backwards. To print something in reverse add [::-1] to the end of the variable name. So name[:--1] would be a reversed string.
Enter your name: Martin
Your name backwards is nitraM.
Med: do Low and then get them, to enter their height in meters and tell them it in feet.
feet= meters * 3.281
Enter your name: Martin
Your name backwards is nitraM.
Enter height in m: 1.5
You are 4.9215 feet.
High: do Med but only print out their height using 2 decimals place. Look at the code below on how to round numbers.
a=2.77777
a=round(a,2)
print(a)
2b). Get someone to enter a word and then:
2c). Get someone to enter 3 numbers then print out the following:
Low: Print out the total
Enter number 1: 7
Enter number 2: 9
Enter number 3: 14
The total is 30.
Med: Print out the total and average
Enter number 1: 7
Enter number 1: 9
Enter number 1: 14
The total is 30.
The average is 10.
High: Print out the total, average and highest and lowest.
Enter number 1: 7
Enter number 1: 9
Enter number 1: 14
The total is 30.
The average is 10.
7 is the lowest and 14 the highest