Help me not fail my exam

Status
Not open for further replies.

mememachine123

Prominent
May 22, 2017
2
0
510
gonna fail cs exam help

do this pls

# Final Exam
#
# Your name here.

# Write Python code to solve 5 problems, 2 points each. 10 points total.

# General hint: You may need some statements outside the loops to initialize things.


#1. While

#Use a while loop with the random.randint function to simulate rolling six-sided dice.
#For each throw, roll two separate dice, and print out the result in the form “You rolled a __ and a __”.
#Continue rolling until you get snake eyes (a one on each die).
#When you do, exit the loop and print “Snake Eyes, Game Over.”





#2. For

#Use a for loop with a three number range to add up all the even numbers between 100 and 200, inclusive.
#(That is, includes both the 100 and 200.) When finished, print out the result.





#3. If

#Prompt the user with the question “Are you glad school’s almost over?”. If the response is a ‘Y’, a ‘y’,
#a ‘YES’ or a ‘yes’ print “We are in agreement.” If the response is anything else, print “We are NOT in agreement.”





#4. Function

#Write a function that takes two numbers represented by variables A and B, and subtracts B from A. It then divides the
#difference by A, and returns the result. You may assume that A is always the larger number, and never zero.





#5. String

#Use the string index capability to return the first half (rounded down) of any given string stored in the variable ‘S’.
#You can use as a test string S = 'QWERTYUIOP!'
#Hint: find the length of the string and divide by two, being careful about the endpoints and int versus float in loops.
 

rgd1101

Don't
Moderator
MERGED QUESTION
Question from mememachine123 : "Help me not fail my Python exam"



 
Status
Not open for further replies.