Skip to content

wDushanin/ITSC-3155-Intro-to-Python-Exercises

Repository files navigation

ITSC-3155-Intro-to-Python-Exercises

Exercise Instructions:

  1. Write a script that takes in a grade from 0-100 inclusive (include both 0 and 100 in the range). Assuming a normal 10 point grading scale, print off whether the user got an A, B, C, D, or F.

  2. Write a script that takes in two strings from the user. If one string is the prefix of the other string, print "True", otherwise, print "False". For example, if the user enters "paint" and "paintbrush", then the script would print "True". If the user entered "painting" and "painted", the script would print "False" because no string begins the other. Keep in mind that the the pair "paint" and "paintbrush" as well as the pair "paintbrush" and "paint" would print "True" because order does not matter.

  3. Take in an integer greater than 1. Print out the squares of each integer from 0 to the inputted integer.

  4. Take in a number, n, from the user. Then, take in n floats from the user and store them in a list. For instance, if the user enters 4, then the user will have to enter 4 numbers. Print the list and the mean.

  5. Take in 5 integers from the user and store them in a list. Then take in another 5 integers and store them in a separate list. Create a third array containing the common values from both arrays without duplicates. Print out this third list.

  6. Take in a row number from 1 to 5 inclusive and a column number from 1 to 5. Print out a grid of 0s, but in the row and column entered by the user, print a 1.

  7. Take in integers until the user types "QUIT" and store the numbers in an array. Assume any input other than "QUIT" is a valid integer. Create another array of just the even numbers and print it.

  8. Take in 10 integers from user. Create a new list with only elements which appear once. Print the list with the unique elements.

  9. Take in 5 words from the user. Create a single string from the individual words, separated by spaces, and print the string.

  10. Take in a string from the user and split it into an array of single characters. Split the list of characters into a list of lists where each inner list has 3 elements. Notice that the last inner array may have less than 3 elements.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages