0% found this document useful (0 votes)
53 views1 page

Practice Programs: ST ' Word in This Sentence That An Even Number of '

1. The document provides 10 practice programming problems of varying levels, including evaluating mathematical expressions, finding the type and methods for operations, string slicing and indexing, checking for palindromes, filtering a string by word length, and a Rock-Paper-Scissors game. 2. It also includes a problem asking the user for their name and age, and printing the year they will turn 100 years old. 3. The problems cover core Python concepts like variables, conditionals, strings, inputs, outputs, and simple math and logic operations.

Uploaded by

Subbu Suni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views1 page

Practice Programs: ST ' Word in This Sentence That An Even Number of '

1. The document provides 10 practice programming problems of varying levels, including evaluating mathematical expressions, finding the type and methods for operations, string slicing and indexing, checking for palindromes, filtering a string by word length, and a Rock-Paper-Scissors game. 2. It also includes a problem asking the user for their name and age, and printing the year they will turn 100 years old. 3. The problems cover core Python concepts like variables, conditionals, strings, inputs, outputs, and simple math and logic operations.

Uploaded by

Subbu Suni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Practice Programs

1. Answer these three questions without typing code. Then type code to check your
answer.
• What is the value of the expression 4 * (6 + 5)? = 44
• What is the value of the expression 4 * 6 + 5? = 29
• What is the value of the expression 4 + 6 * 5? = 34
2. What is the type of the result of the expression 3 + 1.5 + 4?
3. What would you use to find a number’s square root, as well as its Square?
4. Given the string 'hello', give an index command that returns ‘e’.
5. Reverse the string 'hello' using slicing.
6. Given the string ‘hello’, give two methods of producing the letter 'o' using
indexing.
7. Ask the user for a string and print out whether this string is a palindrome or not. (A
palindrome is a string that reads the same forwards and backwards.)
8. Go through the string below and if the length of a word is even or odd print that

st = 'Print every word in this sentence that has an even number of letters’
9. Make a two-player Rock-Paper-Scissors game. (Hint: Ask for player plays (using
input), compare them, print out a message of congratulations to the winner, and ask
if the players want to start a new game)
Remember the rules:
i. Rock beats scissors
ii. Scissors beats paper
iii. Paper beats rock

10. Create a program that asks the user to enter their name and their age. Print out a
message addressed to them that tells them the year that they will turn 100 years
old.

You might also like