r/CodingForBeginners • u/fyknite • 4d ago
Day 6 Learning Python
So far so good. This time around I had to freelance this code all from memory. Definitely ran into some walls and tripped along the way but I introduced the time function and made a neat little count down at the end. if you run the code yourself, you'll see the 1 second delay between each number that gets displayed before the goodbye message.

import time
space_station_name = "OrionStation"
station_current_oxygen_level = 100
station_current_food_level = 50
def consume_supply(current, used):
return current - used
def gain_supply_food(current, gain):
return current + gain
def show_status(station_name, oxygen_level, food_level):
print("SpaceStation:", station_name)
print("OxygenLevel:", oxygen_level)
print("FoodSupply:", food_level)
station_current_oxygen_level = consume_supply(station_current_oxygen_level, 30)
station_current_food_level = consume_supply(station_current_food_level, 15)
station_current_food_level = gain_supply_food(station_current_food_level, 25)
show_status(space_station_name, station_current_oxygen_level, station_current_food_level)
print("This computer will self destruct in:")
print(3)
time.sleep(1)
print(2)
time.sleep(1)
print(1)
time.sleep(1)
print("goodby")1
u/Specialist-Bear-185 8h ago
Yo how did u get so good also trying to learn
2
u/fyknite 3h ago
My best advice is to ask all the questions you need until you understand something, ask AI any doubt you have, ask even if your doubt is minor. Then practice writing the code once you understand what you’re doing but without AI telling you what to write. Use other platforms to learn code as well. AI isn’t the best at really teaching you how to use the skills in real life. It only gets better once you have examples and references that It can help you solve through.
1
u/Willing_Weight7106 4d ago
Practicing Phyton through AI?