Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
1.12/5 (5 votes)
1. Use a variable to represent a person’s name, and print a message to that person. Your message should be simple, such as, “Hello Eric, would you like to learn some Python today?"

2.Use a variable to represent a person’s name, and then print that person’s name in lowercase, uppercase, and title case.

3.Ask the user for 2 integer numbers then print the numbers between the two numbers where the first input is lesser than the 2nd input. If the user gives a non-integer input, print "INVALID INPUT!". If the first input is greater than the 2nd input, print "First number should be lesser than second number."

4. Using one line of code, make a list of odd numbers that are divisible by 5 from 1 to 500 inclusive.


5.A certain CS professor gives 5-point quizzes that are graded on the scale 5-A, 4-B, 3-C, 2-D, 1-F, 0-F. Write a program that accepts a quiz score as an input and prints out the corresponding grade.

6.Create a tuple containing the names of five countries and display the whole tuple. Ask the user to enter one of the countries that have been shown to them and then display the index number (i.e. position in the list) of that item in the tuple.

7.Write a program that calculates the average word length in a sentence entered by the user.

8. Represent the table using a dictionary.
Name Math English Science
Susan 95 97 84
Peter 92 98 89
Mark 89 97 90
Andy 88 93 92

9.Using the dictionary in problem 8, add new item to the dictionary which is the average grade of the 3 subject.

10. Represent the table in problem 8, using only a list

What I have tried:

1. Use a variable to represent a person’s name, and print a message to that person. Your message should be simple, such as, "Hello Eric, would you like to learn some Python today?"
Posted
Updated 18-Mar-21 1:43am
v6
Comments
Maciej Los 16-Mar-21 5:40am    
Wow! Which exactly language do you want to use: C, C++ or Python? Or all together?
Richard MacCutchan 17-Mar-21 7:44am    
OP has deleted the original post which was his/her homework assignment.
OriginalGriff 17-Mar-21 8:10am    
That's OK - I've rolled it back so that the solutions make sense ... :D
Richard MacCutchan 17-Mar-21 8:45am    
Rollback does not seem to work for me, although it used to.
OriginalGriff 17-Mar-21 8:56am    
Strange - you're still a protector. Might be worth a quick word to Chris?

 
Share this answer
 
Comments
Maciej Los 16-Mar-21 5:58am    
5ed!
BTW: i'm not sure what language OP wants to use. At this moment i see: {C, C++, Python, PythonN.N}...
Richard MacCutchan 16-Mar-21 6:37am    
thanks. I made a guess based on the output referred to in question 1 of the assignment.
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]

The specifics of your first step are pretty simple: Basic Input, Output, and String Formatting in Python – Real Python[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900