lab 4 - elif score<60: print...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
# Lab 4 #### import math import random i = False or True print (i) a = True and False print (a) b = not (True and False) print (b) c = (not True) and (not False) print (c) d = 4<5 and 4>3 print (d) def calGPA(score): if score>= 90: print ("A") if score>=80 and score <90: print ("B") if score>= 70 and score <80: print ("C") if score>= 60 and score <70: print ("D") if score<60: print ("F") def calGPA2 (score): if score>= 90: print ("A") elif score>=80 and score <90: print ("B") elif score>= 70 and score <80: print ("C") elif score>= 60 and score <70: print ("D")
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: elif score&lt;60: print (&quot;F&quot;) s1 = &quot;Franklin and Marshall&quot; s2 = &quot; College&quot; print (s1[:8]) print (s1[8:12]) print (s1[12:21]) print (s1+s2) s = s1 + ''+s2 if &quot;ank&quot; in s: print ('yes') else: print ('no') for i in range (len(s)): print (s[0:i]) print (s.upper()) print (s.lower()) print (s.replace(and, &amp;)) def montePi (numDarts): inCircle = 0 for i in range (numDarts): x=random.random() y=random.random() d = math.sqrt (x**2 + y**2) if d &lt;=1: inCircle = inCircle +1 pi = inCircle/numDarts * 4 return pi...
View Full Document

Page1 / 2

lab 4 - elif score&amp;amp;lt;60: print...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online