More than 2000 years ago, Greek astronomer sybakus named the twelve constellations , They are Aquarius , Pisces , Aries , Taurus , Gemini , Cancer , leo , Virgo , libra , scorpio , sagittarius , Cochlear . Give an example
CSV file (PY301-SunSign.csv), An example is as follows :
Serial number , constellation , Start month day , End month day , Unicode
1, aquarius ,120,218,9810
2, Pisces ,219,320,9811
3, Aries ,321,419,9800
4, Taurus ,420,520,9801
5, Gemini ,521,621,9802
…( slightly )
In the first place 1 Behavior examples ,120 express 1 month 20 day ,218 express 2 month 18 day , 9810 yes Unicode code .

<> problem 1

( 5 branch ): stay PY301-1.py Modify code in file , Read in CSV Data in file , Get user input . According to the constellation name entered by the user , Output the date of birth range for this constellation .
The reference input and output sample formats are as follows :
Please input Chinese name of constellation ( for example , Gemini ): Gemini Gemini's birthday is at 521-621 between
f=open("py301-sunsign.csv","r") x=input(" Please input Chinese name of constellation ( for example , Gemini )") ls = [] for line
in f: ls.append(line.strip('\n').split(',')) for row in ls: if row[1].count(x)>0
: print("{} My birthday is at {}-{} between ".format(x,row[2],row[3])) f.close()
<> problem 2

( 10 branch ): stay PY301-2.py Modify code in file , Read in CSV Data in file , Get user input . The user keyboard enters a set of ranges
1-12 As the sequence number , The serial numbers are separated by spaces , End with carriage return . The screen outputs the names of the constellations corresponding to these serial numbers , Character encoding and date of birth range , Information for each constellation , a line . After the completion of this screen display , Return to the status of input serial number .
The reference input and output sample formats are as follows :
Please input constellation number ( for example ,5):5 10
Gemini (9802) What's your birthday 5 month 21 Solstice 6 month 21 Between days
scorpio (9807) What's your birthday 10 month 24 Solstice 11 month 22 Between days
Please input constellation number ( for example ,5 ) :
f=open("py301-sunsign.csv","r") x=input(" Please input constellation number ( for example ,5):") ls = [] for line in f
: ls.append(line.strip('\n').split(',')) num=x.split() for i in num: for row in
ls: if row[0]==i: if len(row[2])==3: m1=row[2][0] d1=row[2][1:3] else: m1=row[2]
[0:2] d1=row[2][2:4] if len(row[3])==3: m2=row[3][0] d2=row[3][1:3] else: m2=row
[3][0:2] d2=row[3][2:4] print("{}({}) What's your birthday {} month {} Solstice {} month {} Between days ".format(row[1],row[4],
m1,d1,m2,d2)) f.close()
<> problem 3

( 5 branch ): In question 2 On the basis of , stay
PY301-3.py Modify code in file , Do legitimacy processing for each serial number input by keyboard . If the number entered is illegal , Please output ” Wrong constellation number !", Continue to output follow-up information , And then return to the status of inputting serial number .
The reference input and output sample formats are as follows :
Please input constellation number ( for example ,5): 5 14 11
Gemini (9802) What's your birthday 5 month 21 Solstice 6 month 21 Between days
Error in entering constellation serial number !
sagittarius (9808) What's your birthday 11 month 23 Solstice 12 month 21 Between days
Please input constellation number ( for example ,5):
f=open("py301-sunsign.csv",'r') ls = [] for line in f: ls.append(line.strip('
\n').split(',')) f.close() x=input(" Please input constellation number ( for example ,5):") num=x.strip(' \n').split()
for i in num: if 0<int(i)<len(ls):# There is a title line in the file , therefore ls Zhongduo line for row in ls: if row[0]==i:
m1=row[2][0] if len(row[2])==3 else row[2][0:2] d1=row[2][1:3] if len(row[2])==
3 else row[2][2:4] m2=row[3][0] if len(row[2])==3 else row[3][0:2] d2=row[3][1:3
] if len(row[2])==3 else row[3][2:4] print("{}({}) It's a birthday {} month {} Solstice {} month {} Between days ".format(
row[1],row[4],m1,d1,m2,d2)) else: print(" Error in entering constellation serial number !")

Technology
©2020 ioDraw All rights reserved
Java exercises 1: Simply define a car class New photo album app launched by Microsoft : Using cross platform framework React Native to write Chapter two Fundamentals of programming Programming exercises pandas Time order of webpack Code segmentation import()Vue slot slot: Default slot , Named slot , Scope slot Fundamentals of data analysis ——R language ( Processing missing values )C++ Implementation of matrix meteor shower effect PostMan Advanced Usage , Interface MD5+Secret autograph Sign The 12th Blue Bridge Cup B group C/C++ Provincial competition