Skip to content

Commit e1a69a2

Browse files
committed
Problem Set 0
0 parents  commit e1a69a2

File tree

6 files changed

+45
-0
lines changed

6 files changed

+45
-0
lines changed

Problem Set 0/einstein/einstein.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
c = 300000000
2+
3+
m = int(input("m: "))
4+
5+
print(m*c*c)

Problem Set 0/faces/faces.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
def main():
2+
msg = input()
3+
result = convert(msg)
4+
print(result)
5+
6+
7+
def convert(msg):
8+
msg1 = msg.replace(":)", "🙂").replace(":(", "🙁")
9+
10+
return msg1
11+
12+
13+
main()

Problem Set 0/indoor/indoor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
message = input("Enter a message: ").lower()
2+
print(message)

Problem Set 0/playback/playback.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
message = input().strip()
2+
3+
rep = message.replace(" ", "...")
4+
5+
print(rep)

Problem Set 0/tip/tip.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
def main():
2+
dollars = dollars_to_float(input("How much was the meal? "))
3+
percent = percent_to_float(input("What percentage would you like to tip? "))
4+
tip = dollars * percent
5+
print(f"Leave ${tip:.2f}")
6+
7+
8+
def dollars_to_float(d):
9+
without_dollar_sign = d.replace("$", "")
10+
return float(without_dollar_sign)
11+
12+
13+
def percent_to_float(p):
14+
without_percent = p.replace("%", "")
15+
p_convert = float(without_percent)/100
16+
return p_convert
17+
18+
19+
main()

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"# CS50s-Introduction-to-Programming-with-Python"

0 commit comments

Comments
 (0)